@Override protected void onBindMethods() { addMethodProxy(new ReplaceLastPkgMethodProxy("isHardwareDetected")); addMethodProxy(new ReplaceLastPkgMethodProxy("hasEnrolledFingerprints")); addMethodProxy(new ReplaceLastPkgMethodProxy("authenticate")); addMethodProxy(new ReplaceLastPkgMethodProxy("cancelAuthentication")); addMethodProxy(new ReplaceLastPkgMethodProxy("getEnrolledFingerprints")); addMethodProxy(new ReplaceLastPkgMethodProxy("getAuthenticatorId")); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { try { return super.call(who, method, args); } catch (InvocationTargetException e) { return onHandleError(e); } } });
@Override public boolean beforeCall(Object who, Method method, Object... args) { replaceLastAppComponent(args, getHostPkg()); return super.beforeCall(who, method, args); }
@Override protected void onBindMethods() { super.onBindMethods(); addMethodProxy(new ReplaceLastPkgMethodProxy("getPrimaryClip")); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) { addMethodProxy(new ReplaceLastPkgMethodProxy("setPrimaryClip")); addMethodProxy(new ReplaceLastPkgMethodProxy("getPrimaryClipDescription")); addMethodProxy(new ReplaceLastPkgMethodProxy("hasPrimaryClip")); addMethodProxy(new ReplaceLastPkgMethodProxy("addPrimaryClipChangedListener")); addMethodProxy(new ReplaceLastPkgMethodProxy("removePrimaryClipChangedListener")); addMethodProxy(new ReplaceLastPkgMethodProxy("hasClipboardText")); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { return 0; } return super.call(who, method, args); } }
@Override public boolean beforeCall(Object who, Method method, Object... args) { MethodParameterUtils.replaceLastAppComponent(args); return super.beforeCall(who, method, args); } }
@Override protected void onBindMethods() { super.onBindMethods(); addMethodProxy(new ReplaceLastPkgMethodProxy("queryUsageStats")); addMethodProxy(new ReplaceLastPkgMethodProxy("queryConfigurations")); addMethodProxy(new ReplaceLastPkgMethodProxy("queryEvents")); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { return mDefValue; } return super.call(who, method, args); } }
@Override protected void onBindMethods() { super.onBindMethods(); addMethodProxy(new ReplaceLastPkgMethodProxy("adjustVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("adjustLocalOrRemoteStreamVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("adjustSuggestedStreamVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("adjustStreamVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("adjustMasterVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("setStreamVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("setMasterVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("setMicrophoneMute")); addMethodProxy(new ReplaceLastPkgMethodProxy("setRingerModeExternal")); addMethodProxy(new ReplaceLastPkgMethodProxy("setRingerModeInternal")); addMethodProxy(new ReplaceLastPkgMethodProxy("setMode")); addMethodProxy(new ReplaceLastPkgMethodProxy("avrcpSupportsAbsoluteVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("abandonAudioFocus")); addMethodProxy(new ReplaceLastPkgMethodProxy("requestAudioFocus")); addMethodProxy(new ReplaceLastPkgMethodProxy("setWiredDeviceConnectionState")); addMethodProxy(new ReplaceLastPkgMethodProxy("setSpeakerphoneOn")); addMethodProxy(new ReplaceLastPkgMethodProxy("setBluetoothScoOn")); addMethodProxy(new ReplaceLastPkgMethodProxy("stopBluetoothSco")); addMethodProxy(new ReplaceLastPkgMethodProxy("startBluetoothSco")); addMethodProxy(new ReplaceLastPkgMethodProxy("disableSafeMediaVolume")); addMethodProxy(new ReplaceLastPkgMethodProxy("registerRemoteControlClient")); addMethodProxy(new ReplaceLastPkgMethodProxy("unregisterAudioFocusClient")); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { // TODO return 0; } return super.call(who, method, args); } }
@Override protected void onBindMethods() { super.onBindMethods(); addMethodProxy(new ReplaceCallingPkgMethodProxy("getAllSubInfoList")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getAllSubInfoCount")); addMethodProxy(new ReplaceLastPkgMethodProxy("getActiveSubscriptionInfo")); addMethodProxy(new ReplaceLastPkgMethodProxy("getActiveSubscriptionInfoForIccId")); addMethodProxy(new ReplaceLastPkgMethodProxy("getActiveSubscriptionInfoForSimSlotIndex")); addMethodProxy(new ReplaceLastPkgMethodProxy("getActiveSubscriptionInfoList")); addMethodProxy(new ReplaceLastPkgMethodProxy("getActiveSubInfoCount")); addMethodProxy(new ReplaceLastPkgMethodProxy("getSubscriptionProperty")); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (!(args[0] instanceof String)) { LocationRequest request = (LocationRequest) args[0]; fixLocationRequest(request); } if (isFakeLocationEnable()) { VLocation loc = VirtualLocationManager.get().getLocation(); if (loc != null) { return loc.toSysLocation(); } else { return null; } } return super.call(who, method, args); } }
@SuppressLint("WrongConstant") @Override public void inject() throws Throwable { super.inject(); try { Object AutoFillManagerInstance = getContext().getSystemService(AUTO_FILL_NAME); if (AutoFillManagerInstance == null) { throw new NullPointerException("AutoFillManagerInstance is null."); } Object AutoFillManagerProxy = getInvocationStub().getProxyInterface(); if (AutoFillManagerProxy == null) { throw new NullPointerException("AutoFillManagerProxy is null."); } Field AutoFillManagerServiceField = AutoFillManagerInstance.getClass().getDeclaredField("mService"); AutoFillManagerServiceField.setAccessible(true); AutoFillManagerServiceField.set(AutoFillManagerInstance, AutoFillManagerProxy); } catch (Throwable tr) { Log.e(TAG, "AutoFillManagerStub inject error.", tr); return; } addMethodProxy(new ReplacePkgAndComponentProxy("startSession")); addMethodProxy(new ReplacePkgAndComponentProxy("updateOrRestartSession")); addMethodProxy(new ReplaceLastPkgMethodProxy("isServiceEnabled")); }
@Override public Object call(final Object who, Method method, Object... args) throws Throwable { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { LocationRequest request = (LocationRequest) args[0]; fixLocationRequest(request); } if (isFakeLocationEnable()) { Object transport = ArrayUtils.getFirst(args, mirror.android.location.LocationManager.ListenerTransport.TYPE); if (transport != null) { Object locationManager = mirror.android.location.LocationManager.ListenerTransport.this$0.get(transport); MockLocationHelper.setGpsStatus(locationManager); GPSListenerThread.get().addListenerTransport(locationManager); } return 0; } return super.call(who, method, args); } }
@Override protected void onBindMethods() { super.onBindMethods(); addMethodProxy(new ReplaceLastPkgMethodProxy("getNaiForSubscriber")); addMethodProxy(new ReplaceLastPkgMethodProxy("getImeiForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getDeviceSvn")); addMethodProxy(new ReplaceLastPkgMethodProxy("getDeviceSvnUsingSubId")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getSubscriberId")); addMethodProxy(new ReplaceLastPkgMethodProxy("getSubscriberIdForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getGroupIdLevel1")); addMethodProxy(new ReplaceLastPkgMethodProxy("getGroupIdLevel1ForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getLine1Number")); addMethodProxy(new ReplaceLastPkgMethodProxy("getLine1NumberForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getLine1AlphaTag")); addMethodProxy(new ReplaceLastPkgMethodProxy("getLine1AlphaTagForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getMsisdn")); addMethodProxy(new ReplaceLastPkgMethodProxy("getMsisdnForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getVoiceMailNumber")); addMethodProxy(new ReplaceLastPkgMethodProxy("getVoiceMailNumberForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getVoiceMailAlphaTag")); addMethodProxy(new ReplaceLastPkgMethodProxy("getVoiceMailAlphaTagForSubscriber")); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { Object transport = ArrayUtils.getFirst(args, mirror.android.location.LocationManager.GpsStatusListenerTransport.TYPE); Object locationManager = mirror.android.location.LocationManager.GpsStatusListenerTransport.this$0.get(transport); mirror.android.location.LocationManager.GpsStatusListenerTransport.onGpsStarted.call(transport); mirror.android.location.LocationManager.GpsStatusListenerTransport.onFirstFix.call(transport, 0); if (mirror.android.location.LocationManager.GpsStatusListenerTransport.mListener.get(transport) != null) { MockLocationHelper.invokeSvStatusChanged(transport); } else { MockLocationHelper.invokeNmeaReceived(transport); } GPSListenerThread.get().addListenerTransport(locationManager); return true; } return super.call(who, method, args); } }
super.onBindMethods(); addMethodProxy(new ReplaceCallingPkgMethodProxy("isOffhook")); addMethodProxy(new ReplaceLastPkgMethodProxy("getLine1NumberForDisplay")); addMethodProxy(new ReplaceLastPkgMethodProxy("isOffhookForSubscriber")); addMethodProxy(new ReplaceLastPkgMethodProxy("isRingingForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("call")); addMethodProxy(new ReplaceCallingPkgMethodProxy("isRinging")); addMethodProxy(new ReplaceCallingPkgMethodProxy("isIdle")); addMethodProxy(new ReplaceLastPkgMethodProxy("isIdleForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("isRadioOn")); addMethodProxy(new ReplaceLastPkgMethodProxy("isRadioOnForSubscriber")); addMethodProxy(new ReplaceLastPkgMethodProxy("isSimPinEnabled")); addMethodProxy(new ReplaceLastPkgMethodProxy("getCdmaEriIconIndex")); addMethodProxy(new ReplaceLastPkgMethodProxy("getCdmaEriIconIndexForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getCdmaEriIconMode")); addMethodProxy(new ReplaceLastPkgMethodProxy("getCdmaEriIconModeForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getCdmaEriText")); addMethodProxy(new ReplaceLastPkgMethodProxy("getCdmaEriTextForSubscriber")); addMethodProxy(new ReplaceLastPkgMethodProxy("getNetworkTypeForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getDataNetworkType")); addMethodProxy(new ReplaceLastPkgMethodProxy("getDataNetworkTypeForSubscriber")); addMethodProxy(new ReplaceLastPkgMethodProxy("getVoiceNetworkTypeForSubscriber")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getLteOnCdmaMode")); addMethodProxy(new ReplaceLastPkgMethodProxy("getLteOnCdmaModeForSubscriber")); addMethodProxy(new ReplaceLastPkgMethodProxy("getCalculatedPreferredNetworkType")); addMethodProxy(new ReplaceLastPkgMethodProxy("getPcscfAddress")); addMethodProxy(new ReplaceLastPkgMethodProxy("getLine1AlphaTagForDisplay")); addMethodProxy(new ReplaceCallingPkgMethodProxy("getMergedSubscriberIds")); addMethodProxy(new ReplaceLastPkgMethodProxy("getRadioAccessFamily"));
@Override public Object call(Object who, Method method, Object... args) throws Throwable { try { return super.call(who, method, args); } catch (InvocationTargetException e) { return onHandleError(e); } } });
super.onBindMethods(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { addMethodProxy(new ReplaceLastPkgMethodProxy("addTestProvider")); addMethodProxy(new ReplaceLastPkgMethodProxy("removeTestProvider")); addMethodProxy(new ReplaceLastPkgMethodProxy("setTestProviderLocation")); addMethodProxy(new ReplaceLastPkgMethodProxy("clearTestProviderLocation")); addMethodProxy(new ReplaceLastPkgMethodProxy("setTestProviderEnabled")); addMethodProxy(new ReplaceLastPkgMethodProxy("clearTestProviderEnabled")); addMethodProxy(new ReplaceLastPkgMethodProxy("setTestProviderStatus")); addMethodProxy(new ReplaceLastPkgMethodProxy("clearTestProviderStatus"));
@Override public Object call(Object who, Method method, Object... args) throws Throwable { try { return super.call(who, method, args); } catch (InvocationTargetException e) { return onHandleError(e); } } });