├── .gitignore ├── DOC └── 插件机制介绍.pptx ├── LICENSE ├── project ├── Libraries │ └── DroidPlugin │ │ ├── AndroidManifest.xml │ │ ├── LICENSE.txt │ │ ├── build.gradle │ │ ├── lib │ │ └── layoutlib.jar │ │ ├── proguard-project.txt │ │ ├── project.properties │ │ ├── res │ │ ├── drawable-xxhdpi │ │ │ ├── plugin_activity_loading.xml │ │ │ └── plugin_activity_loading_bitmap.9.png │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── values-v14 │ │ │ └── styles.xml │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── src │ │ ├── android │ │ └── app │ │ │ └── IServiceConnection.aidl │ │ └── com │ │ └── morgoo │ │ ├── droidplugin │ │ ├── MyCrashHandler.java │ │ ├── PluginApplication.java │ │ ├── PluginHelper.java │ │ ├── PluginManagerService.java │ │ ├── PluginPatchManager.java │ │ ├── am │ │ │ ├── BaseActivityManagerService.java │ │ │ ├── MyActivityManagerService.java │ │ │ ├── RunningActivities.java │ │ │ ├── RunningProcesList.java │ │ │ ├── ServiceStubMap.java │ │ │ └── StaticProcessList.java │ │ ├── core │ │ │ ├── Env.java │ │ │ ├── PluginClassLoader.java │ │ │ ├── PluginDirHelper.java │ │ │ └── PluginProcessManager.java │ │ ├── hook │ │ │ ├── BaseHookHandle.java │ │ │ ├── Hook.java │ │ │ ├── HookFactory.java │ │ │ ├── HookedMethodHandler.java │ │ │ ├── binder │ │ │ │ ├── BinderHook.java │ │ │ │ ├── IAudioServiceBinderHook.java │ │ │ │ ├── IClipboardBinderHook.java │ │ │ │ ├── IContentServiceBinderHook.java │ │ │ │ ├── IGraphicsStatsBinderHook.java │ │ │ │ ├── IInputMethodManagerBinderHook.java │ │ │ │ ├── ILocationManagerBinderHook.java │ │ │ │ ├── IMediaRouterServiceBinderHook.java │ │ │ │ ├── IMountServiceBinderHook.java │ │ │ │ ├── INotificationManagerBinderHook.java │ │ │ │ ├── ISearchManagerBinderHook.java │ │ │ │ ├── ISessionManagerBinderHook.java │ │ │ │ ├── IWifiManagerBinderHook.java │ │ │ │ ├── IWindowManagerBinderHook.java │ │ │ │ ├── MyServiceManager.java │ │ │ │ ├── ServiceManagerBinderHook.java │ │ │ │ └── ServiceManagerCacheBinderHook.java │ │ │ ├── handle │ │ │ │ ├── IActivityManagerHookHandle.java │ │ │ │ ├── IAudioServiceHookHandle.java │ │ │ │ ├── IClipboardHookHandle.java │ │ │ │ ├── IContentProviderInvokeHandle.java │ │ │ │ ├── IContentServiceHandle.java │ │ │ │ ├── IGraphicsStatsHookHandle.java │ │ │ │ ├── IInputMethodManagerHookHandle.java │ │ │ │ ├── ILocationManagerHookHandle.java │ │ │ │ ├── IMediaRouterServiceHookHandle.java │ │ │ │ ├── IMountServiceHookHandle.java │ │ │ │ ├── INotificationManagerHookHandle.java │ │ │ │ ├── IPackageManagerHookHandle.java │ │ │ │ ├── ISearchManagerHookHandle.java │ │ │ │ ├── ISessionManagerHookHandle.java │ │ │ │ ├── IWifiManagerHookHandle.java │ │ │ │ ├── IWindowManagerHookHandle.java │ │ │ │ ├── IWindowSessionInvokeHandle.java │ │ │ │ ├── LibCoreHookHandle.java │ │ │ │ ├── PluginCallback.java │ │ │ │ ├── PluginInstrumentation.java │ │ │ │ ├── ReplaceCallingPackageHookedMethodHandler.java │ │ │ │ └── WebViewFactoryProviderHookHandle.java │ │ │ ├── proxy │ │ │ │ ├── IActivityManagerHook.java │ │ │ │ ├── IContentProviderHook.java │ │ │ │ ├── IPackageManagerHook.java │ │ │ │ ├── IWindowSessionHook.java │ │ │ │ ├── InstrumentationHook.java │ │ │ │ ├── LibCoreHook.java │ │ │ │ ├── PluginCallbackHook.java │ │ │ │ ├── ProxyHook.java │ │ │ │ └── WebViewFactoryProviderHook.java │ │ │ └── xhook │ │ │ │ └── SQLiteDatabaseHook.java │ │ ├── pm │ │ │ ├── IApplicationCallback.aidl │ │ │ ├── IPackageDataObserver.aidl │ │ │ ├── IPluginManager.aidl │ │ │ ├── IPluginManagerImpl.java │ │ │ ├── PluginManager.java │ │ │ └── parser │ │ │ │ ├── IntentMatcher.java │ │ │ │ ├── PackageParser.java │ │ │ │ ├── PackageParserApi15.java │ │ │ │ ├── PackageParserApi16.java │ │ │ │ ├── PackageParserApi20.java │ │ │ │ ├── PackageParserApi21.java │ │ │ │ ├── PackageParserApi22.java │ │ │ │ ├── PackageParserApi22Preview1.java │ │ │ │ └── PluginPackageParser.java │ │ ├── reflect │ │ │ ├── FieldUtils.java │ │ │ ├── MemberUtils.java │ │ │ ├── MethodUtils.java │ │ │ ├── Utils.java │ │ │ └── Validate.java │ │ └── stub │ │ │ ├── AbstractContentProviderStub.java │ │ │ ├── AbstractServiceStub.java │ │ │ ├── ActivityStub.java │ │ │ ├── ContentProviderStub.java │ │ │ ├── MyFakeIBinder.java │ │ │ ├── ServcesManager.java │ │ │ ├── ServiceStub.java │ │ │ └── ShortcutProxyActivity.java │ │ └── helper │ │ ├── AttributeCache.java │ │ ├── ComponentNameComparator.java │ │ ├── Log.java │ │ ├── MyProxy.java │ │ ├── Utils.java │ │ └── compat │ │ ├── ActivityManagerCompat.java │ │ ├── ActivityManagerNativeCompat.java │ │ ├── ActivityThreadCompat.java │ │ ├── BuildCompat.java │ │ ├── CompatibilityInfoCompat.java │ │ ├── ContentProviderHolderCompat.java │ │ ├── IActivityManagerCompat.java │ │ ├── IAudioServiceCompat.java │ │ ├── IClipboardCompat.java │ │ ├── IContentServiceCompat.java │ │ ├── IGraphicsStatsCompat.java │ │ ├── IInputMethodManagerCompat.java │ │ ├── ILocationManagerCompat.java │ │ ├── IMediaRouterServiceCompat.java │ │ ├── IMountServiceCompat.java │ │ ├── INotificationManagerCompat.java │ │ ├── IPackageDataObserverCompat.java │ │ ├── ISearchManagerCompat.java │ │ ├── ISessionManagerCompat.java │ │ ├── IWifiManagerCompat.java │ │ ├── IWindowManagerCompat.java │ │ ├── PackageManagerCompat.java │ │ ├── ParceledListSliceCompat.java │ │ ├── ProcessCompat.java │ │ ├── QueuedWorkCompat.java │ │ ├── ServiceManagerCompat.java │ │ ├── SingletonCompat.java │ │ ├── SystemPropertiesCompat.java │ │ ├── UserHandleCompat.java │ │ ├── VMRuntimeCompat.java │ │ └── WebViewFactoryCompat.java ├── Test │ └── ApiTest │ │ ├── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── jni │ │ ├── Core.cpp │ │ ├── HelperJni │ │ │ ├── HelperJni.cpp │ │ │ └── HelperJni.h │ │ └── help │ │ │ ├── log.h │ │ │ └── nativehelper │ │ │ ├── JNIHelp.cpp │ │ │ └── JNIHelp.h │ │ ├── lib │ │ └── dalviksystem.jar │ │ ├── proguard-project.txt │ │ ├── project.properties │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── layout │ │ │ ├── activity_activity_test.xml │ │ │ ├── activity_launchmode.xml │ │ │ ├── activity_native_test.xml │ │ │ ├── activity_web_view_test.xml │ │ │ ├── broadcast_receiver.xml │ │ │ ├── content_provider.xml │ │ │ ├── main.xml │ │ │ ├── notification_test.xml │ │ │ └── service.xml │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── values-v14 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── src │ │ └── com │ │ ├── example │ │ └── ApiTest │ │ │ ├── ActivityTestActivity.java │ │ │ ├── BaseService.java │ │ │ ├── Binder1.aidl │ │ │ ├── Binder2.aidl │ │ │ ├── BroadcastReceiverTest.java │ │ │ ├── ContentProviderTest.java │ │ │ ├── ContentProviderTest2.java │ │ │ ├── LaunchModeTestActivity.java │ │ │ ├── MyActivity.java │ │ │ ├── MyContentProvider1.java │ │ │ ├── MyContentProvider2.java │ │ │ ├── NativeTestActivity.java │ │ │ ├── NotificationTest.java │ │ │ ├── Service1.java │ │ │ ├── Service2.java │ │ │ ├── Service3.java │ │ │ ├── Service4.java │ │ │ ├── ServiceTest1.java │ │ │ ├── ServiceTest2.java │ │ │ ├── SingleInstanceActivity.java │ │ │ ├── SingleTaskActivity.java │ │ │ ├── SingleTopActivity.java │ │ │ ├── StandardActivity.java │ │ │ ├── StaticBroadcastReceiver.java │ │ │ └── WebViewTestActivity.java │ │ └── morgoo │ │ └── nativec │ │ └── NativeCHelper.java ├── TestPlugin │ ├── AndroidManifest.xml │ ├── build.gradle │ ├── proguard-project.txt │ ├── project.properties │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── layout │ │ │ ├── apk_item.xml │ │ │ └── main.xml │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── values-v14 │ │ │ └── styles.xml │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── src │ │ └── com │ │ └── example │ │ └── TestPlugin │ │ ├── ApkFragment.java │ │ ├── ApkItem.java │ │ ├── InstalledFragment.java │ │ └── MyActivity.java ├── build.gradle ├── gradle.properties ├── gradlew ├── gradlew.bat └── settings.gradle └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | /project/Libraries/DroidPlugin/gen 2 | /project/Libraries/DroidPlugin/bin 3 | /project/Test/ApiTest/gen 4 | /project/Test/ApiTest/bin 5 | /project/TestPlugin/gen 6 | /project/TestPlugin/bin 7 | /project/gradle 8 | /project/.gradle 9 | /project/.idea 10 | /project/build 11 | /project/local.properties 12 | /happy_chinese_new_year_of_monkey 13 | *.iml 14 | -------------------------------------------------------------------------------- /DOC/插件机制介绍.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/DOC/插件机制介绍.pptx -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | dependencies { 4 | provided fileTree(dir: 'lib', include: '*.jar') 5 | compile fileTree(dir: 'libs', include: '*.jar') 6 | } 7 | 8 | android { 9 | compileSdkVersion rootProject.ext.compileSdkVersion 10 | buildToolsVersion rootProject.ext.buildToolsVersion 11 | sourceSets { 12 | main { 13 | manifest.srcFile 'AndroidManifest.xml' 14 | java.srcDirs = ['src'] 15 | resources.srcDirs = ['src'] 16 | aidl.srcDirs = ['src'] 17 | renderscript.srcDirs = ['src'] 18 | res.srcDirs = ['res'] 19 | assets.srcDirs = ['assets'] 20 | jniLibs.srcDirs = ['libs'] 21 | } 22 | 23 | instrumentTest.setRoot('tests') 24 | debug.setRoot('build-types/debug') 25 | release.setRoot('build-types/release') 26 | } 27 | 28 | lintOptions { 29 | abortOnError false 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/lib/layoutlib.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/Libraries/DroidPlugin/lib/layoutlib.jar -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | 22 | 23 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-21 15 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/res/drawable-xxhdpi/plugin_activity_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/res/drawable-xxhdpi/plugin_activity_loading_bitmap.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/Libraries/DroidPlugin/res/drawable-xxhdpi/plugin_activity_loading_bitmap.9.png -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 31 | 32 | 35 | 36 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 36 | 37 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 启动插件ing... 27 | 插件代理服务 28 | 插件代理服务 29 | 插件管理服务 30 | 31 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 29 | 30 | 33 | 34 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/android/app/IServiceConnection.aidl: -------------------------------------------------------------------------------- 1 | /* //device/java/android/android/app/IServiceConnection.aidl 2 | ** 3 | ** Copyright 2007, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | package android.app; 19 | 20 | import android.content.ComponentName; 21 | 22 | /** @hide */ 23 | oneway interface IServiceConnection { 24 | void connected(in ComponentName name, IBinder service); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/PluginApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin; 24 | 25 | import android.app.Application; 26 | import android.content.Context; 27 | 28 | /** 29 | * Created by Andy Zhang(zhangyong232@gmail.com) 2014/12/5. 30 | */ 31 | public class PluginApplication extends Application { 32 | 33 | private static final String TAG = PluginApplication.class.getSimpleName(); 34 | 35 | @Override 36 | public void onCreate() { 37 | super.onCreate(); 38 | PluginHelper.getInstance().applicationOnCreate(getBaseContext()); 39 | } 40 | 41 | 42 | @Override 43 | protected void attachBaseContext(Context base) { 44 | PluginHelper.getInstance().applicationAttachBaseContext(base); 45 | super.attachBaseContext(base); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/PluginManagerService.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin; 24 | 25 | import android.app.Notification; 26 | import android.app.Service; 27 | import android.content.Intent; 28 | import android.os.IBinder; 29 | 30 | import com.morgoo.droidplugin.hook.handle.IActivityManagerHookHandle; 31 | import com.morgoo.droidplugin.pm.IPluginManagerImpl; 32 | 33 | /** 34 | * 插件管理服务。 35 | *

36 | * Code by Andy Zhang (zhangyong232@gmail.com) on 2015/2/11. 37 | */ 38 | public class PluginManagerService extends Service { 39 | 40 | private static final String TAG = PluginManagerService.class.getSimpleName(); 41 | private IPluginManagerImpl mPluginPackageManager; 42 | 43 | @Override 44 | public void onCreate() { 45 | super.onCreate(); 46 | keepAlive(); 47 | mPluginPackageManager = new IPluginManagerImpl(this); 48 | mPluginPackageManager.onCreate(); 49 | 50 | } 51 | 52 | private void keepAlive() { 53 | try { 54 | Notification notification = new Notification(); 55 | notification.flags |= Notification.FLAG_NO_CLEAR; 56 | notification.flags |= Notification.FLAG_ONGOING_EVENT; 57 | startForeground(0, notification); // 设置为前台服务避免kill,Android4.3及以上需要设置id为0时通知栏才不显示该通知; 58 | } catch (Throwable e) { 59 | e.printStackTrace(); 60 | } 61 | } 62 | 63 | @Override 64 | public void onDestroy() { 65 | try { 66 | mPluginPackageManager.onDestroy(); 67 | } catch (Exception e) { 68 | e.printStackTrace(); 69 | } 70 | super.onDestroy(); 71 | } 72 | 73 | @Override 74 | public IBinder onBind(Intent intent) { 75 | return mPluginPackageManager; 76 | } 77 | 78 | @Override 79 | public int onStartCommand(Intent intent, int flags, int startId) { 80 | //这里要处理IntentService 81 | IActivityManagerHookHandle.getIntentSender.handlePendingIntent(this, intent); 82 | return super.onStartCommand(intent, flags, startId); 83 | } 84 | 85 | 86 | } 87 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/PluginPatchManager.java: -------------------------------------------------------------------------------- 1 | package com.morgoo.droidplugin; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Handler; 7 | import android.os.Looper; 8 | 9 | import com.morgoo.droidplugin.pm.PluginManager; 10 | 11 | /** 12 | * Created by zhanglong on 2015/12/21. 13 | */ 14 | 15 | // 处理插件异常情况 16 | public class PluginPatchManager { 17 | 18 | private static final int MAX_WAIT_DAEAMON_TIME = 5000; 19 | private static final int CHECK_DAEAMON_INTERVAL = 300; 20 | 21 | private Context mContext; 22 | 23 | private Runnable mDelayRunnable; 24 | private Intent mDelayIntent; 25 | private Handler MainThreadHandler; 26 | private long lStartTime = 0; 27 | 28 | private static PluginPatchManager s_inst = new PluginPatchManager(); 29 | public static PluginPatchManager getInstance() { 30 | return s_inst; 31 | } 32 | 33 | public void init(Context context){ 34 | mContext = context; 35 | } 36 | 37 | // 是否可以启动插件的activity 38 | public boolean canStartPluginActivity(Intent intent) { 39 | if (intent == null || PluginManager.getInstance().isConnected()) 40 | return true; 41 | 42 | ComponentName name = intent.getComponent(); 43 | if (name != null && mContext != null && !name.getPackageName().equals(mContext.getPackageName())) 44 | return false; 45 | 46 | return true; 47 | } 48 | 49 | public boolean startPluginActivity(Intent intent) { 50 | if (intent == null) 51 | return false; 52 | 53 | if (PluginManager.getInstance().isConnected()) { 54 | mDelayIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 55 | mContext.startActivity(mDelayIntent); 56 | return true; 57 | } 58 | 59 | PluginManager.getInstance().connectToService(); 60 | initInner(); 61 | mDelayIntent = intent; 62 | lStartTime = System.currentTimeMillis(); 63 | MainThreadHandler.postDelayed(mDelayRunnable, CHECK_DAEAMON_INTERVAL); 64 | return true; 65 | } 66 | 67 | private void postDelayImpl() { 68 | if (PluginManager.getInstance().isConnected()) { 69 | mDelayIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 70 | mContext.startActivity(mDelayIntent); 71 | } else { 72 | if (System.currentTimeMillis() - lStartTime < MAX_WAIT_DAEAMON_TIME) { 73 | MainThreadHandler.postDelayed(mDelayRunnable, CHECK_DAEAMON_INTERVAL); 74 | } 75 | } 76 | } 77 | 78 | private void initInner() { 79 | if (MainThreadHandler == null) 80 | MainThreadHandler = new Handler(Looper.getMainLooper()); 81 | 82 | if (mDelayRunnable == null) { 83 | mDelayRunnable = new Runnable() { 84 | @Override 85 | public void run() { 86 | postDelayImpl(); 87 | } 88 | }; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/core/Env.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.core; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/2/6. 27 | */ 28 | public class Env { 29 | public static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT"; 30 | public static final String ACTION_UNINSTALL_SHORTCUT = "com.android.launcher.action.UNINSTALL_SHORTCUT"; 31 | 32 | public static final String EXTRA_TARGET_INTENT = "com.morgoo.droidplugin.OldIntent"; 33 | public static final String EXTRA_TARGET_INTENT_URI = "com.morgoo.droidplugin.OldIntent.Uri"; 34 | public static final String EXTRA_TARGET_INFO = "com.morgoo.droidplugin.OldInfo"; 35 | public static final String EXTRA_STUB_INFO = "com.morgoo.droidplugin.NewInfo"; 36 | public static final String EXTRA_TARGET_AUTHORITY = "TargetAuthority"; 37 | public static final String EXTRA_TYPE = "com.morgoo.droidplugin.EXTRA_TYPE"; 38 | public static final String EXTRA_ACTION = "com.morgoo.droidplugin.EXTRA_ACTION"; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/core/PluginClassLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.core; 24 | 25 | import android.os.Build; 26 | 27 | import com.morgoo.helper.Log; 28 | 29 | import java.util.ArrayList; 30 | import java.util.List; 31 | 32 | import dalvik.system.DexClassLoader; 33 | 34 | /** 35 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/2/4. 36 | */ 37 | public class PluginClassLoader extends DexClassLoader { 38 | 39 | public PluginClassLoader(String apkfile, String optimizedDirectory, String libraryPath, ClassLoader systemClassLoader) { 40 | super(apkfile, optimizedDirectory, libraryPath, systemClassLoader); 41 | } 42 | 43 | private static final List sPreLoader = new ArrayList<>(); 44 | 45 | static { 46 | sPreLoader.add("QIKU"); 47 | } 48 | 49 | @Override 50 | protected Class loadClass(String className, boolean resolve) throws ClassNotFoundException { 51 | 52 | if (Build.MANUFACTURER != null && sPreLoader.contains(Build.MANUFACTURER.toUpperCase())) { 53 | try { 54 | /** 55 | * FUCK QIKU! 56 | * 这里适配奇酷手机青春版。 57 | * 因为奇酷手机自己加载了自己修改过的的Support V4库,在插件中也用了这个库的时候,ClassLoader会优先加载奇酷手机自带的Support V4库。 58 | * 原因在于,奇酷手机没有预加载插件中打的Support V4库。详情可以研究super.loadClass(className, resolve)标准实现 59 | * 但是这可能会导致类不兼容,出现java.lang.IncompatibleClassChangeError。因为插件编译时使用的插件的Support V4,而奇酷手机则使 60 | * 用的是它修改过的Support V4。 61 | * 62 | * SO,在Class Loader加载某个Class的时候,我们优先从自己的ClassLoader中加载Class,如果找不到,再从Parent Class Loader中去加载。 63 | * 这样修改后,Class的加载顺序就跟系统的不一样了。 64 | * 65 | */ 66 | Class clazz = findClass(className); 67 | if (clazz != null) { 68 | return clazz; 69 | } 70 | } catch (ClassNotFoundException e) { 71 | Log.e("PluginClassLoader", "UCK QIKU:error", e); 72 | } 73 | } 74 | return super.loadClass(className, resolve); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/BaseHookHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook; 24 | 25 | import android.content.Context; 26 | 27 | import java.lang.reflect.Method; 28 | import java.util.HashMap; 29 | import java.util.Map; 30 | import java.util.Set; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/2/28. 34 | */ 35 | public abstract class BaseHookHandle { 36 | 37 | protected Context mHostContext; 38 | 39 | protected Map sHookedMethodHandlers = new HashMap(5); 40 | 41 | public BaseHookHandle(Context hostContext) { 42 | mHostContext = hostContext; 43 | init(); 44 | } 45 | 46 | protected abstract void init(); 47 | 48 | public Set getHookedMethodNames(){ 49 | return sHookedMethodHandlers.keySet(); 50 | } 51 | 52 | public HookedMethodHandler getHookedMethodHandler(Method method) { 53 | if (method != null) { 54 | return sHookedMethodHandlers.get(method.getName()); 55 | } else { 56 | return null; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/Hook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook; 24 | 25 | import android.content.Context; 26 | 27 | /** 28 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/2. 29 | */ 30 | public abstract class Hook { 31 | 32 | private boolean mEnable = false; 33 | 34 | protected Context mHostContext; 35 | protected BaseHookHandle mHookHandles; 36 | 37 | public void setEnable(boolean enable, boolean reInstallHook) { 38 | this.mEnable = enable; 39 | } 40 | 41 | public final void setEnable(boolean enable) { 42 | setEnable(enable, false); 43 | } 44 | 45 | public boolean isEnable() { 46 | return mEnable; 47 | } 48 | 49 | 50 | protected Hook(Context hostContext) { 51 | mHostContext = hostContext; 52 | mHookHandles = createHookHandle(); 53 | } 54 | 55 | protected abstract BaseHookHandle createHookHandle(); 56 | 57 | 58 | protected abstract void onInstall(ClassLoader classLoader) throws Throwable; 59 | 60 | protected void onUnInstall(ClassLoader classLoader) throws Throwable { 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/IAudioServiceBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | 28 | import com.morgoo.droidplugin.hook.BaseHookHandle; 29 | import com.morgoo.droidplugin.hook.handle.IAudioServiceHookHandle; 30 | import com.morgoo.helper.compat.IAudioServiceCompat; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/6. 34 | */ 35 | public class IAudioServiceBinderHook extends BinderHook { 36 | 37 | private final static String SERVICE_NAME = Context.AUDIO_SERVICE; 38 | 39 | public IAudioServiceBinderHook(Context hostContext) { 40 | super(hostContext); 41 | } 42 | 43 | @Override 44 | public Object getOldObj() throws Exception { 45 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 46 | return IAudioServiceCompat.asInterface(iBinder); 47 | } 48 | 49 | @Override 50 | public String getServiceName() { 51 | return SERVICE_NAME; 52 | } 53 | 54 | @Override 55 | protected BaseHookHandle createHookHandle() { 56 | return new IAudioServiceHookHandle(mHostContext); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/IClipboardBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.handle.IClipboardHookHandle; 29 | import com.morgoo.helper.compat.IClipboardCompat; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/6. 33 | */ 34 | public class IClipboardBinderHook extends BinderHook { 35 | 36 | private final static String CLIPBOARD_SERVICE = "clipboard"; 37 | 38 | public IClipboardBinderHook(Context hostContext) { 39 | super(hostContext); 40 | } 41 | 42 | @Override 43 | public Object getOldObj() throws Exception{ 44 | IBinder iBinder = MyServiceManager.getOriginService(CLIPBOARD_SERVICE); 45 | return IClipboardCompat.asInterface(iBinder); 46 | } 47 | 48 | @Override 49 | public String getServiceName() { 50 | return CLIPBOARD_SERVICE; 51 | } 52 | 53 | @Override 54 | protected BaseHookHandle createHookHandle() { 55 | return new IClipboardHookHandle(mHostContext); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/IContentServiceBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | 28 | import com.morgoo.droidplugin.hook.BaseHookHandle; 29 | import com.morgoo.droidplugin.hook.handle.IContentServiceHandle; 30 | import com.morgoo.helper.compat.IContentServiceCompat; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/21. 34 | */ 35 | public class IContentServiceBinderHook extends BinderHook { 36 | 37 | private static final String CONTENT_SERVICE_NAME = "content"; 38 | 39 | public IContentServiceBinderHook(Context hostContext) { 40 | super(hostContext); 41 | } 42 | 43 | @Override 44 | public Object getOldObj() throws Exception { 45 | IBinder iBinder = MyServiceManager.getOriginService(CONTENT_SERVICE_NAME); 46 | return IContentServiceCompat.asInterface(iBinder); 47 | } 48 | 49 | @Override 50 | public String getServiceName() { 51 | return CONTENT_SERVICE_NAME; 52 | } 53 | 54 | @Override 55 | protected BaseHookHandle createHookHandle() { 56 | return new IContentServiceHandle(mHostContext); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/IGraphicsStatsBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | 28 | import com.morgoo.droidplugin.hook.BaseHookHandle; 29 | import com.morgoo.droidplugin.hook.handle.IClipboardHookHandle; 30 | import com.morgoo.droidplugin.hook.handle.IGraphicsStatsHookHandle; 31 | import com.morgoo.helper.compat.IClipboardCompat; 32 | import com.morgoo.helper.compat.IGraphicsStatsCompat; 33 | 34 | /** 35 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/6/18. 36 | */ 37 | public class IGraphicsStatsBinderHook extends BinderHook { 38 | 39 | private final static String SERVICE_NAME = "graphicsstats"; 40 | 41 | public IGraphicsStatsBinderHook(Context hostContext) { 42 | super(hostContext); 43 | } 44 | 45 | @Override 46 | public Object getOldObj() throws Exception{ 47 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 48 | return IGraphicsStatsCompat.asInterface(iBinder); 49 | } 50 | 51 | @Override 52 | public String getServiceName() { 53 | return SERVICE_NAME; 54 | } 55 | 56 | @Override 57 | protected BaseHookHandle createHookHandle() { 58 | return new IGraphicsStatsHookHandle(mHostContext); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/IInputMethodManagerBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | import android.view.inputmethod.InputMethodManager; 28 | 29 | import com.morgoo.droidplugin.hook.BaseHookHandle; 30 | import com.morgoo.droidplugin.hook.handle.IAudioServiceHookHandle; 31 | import com.morgoo.droidplugin.hook.handle.IInputMethodManagerHookHandle; 32 | import com.morgoo.droidplugin.reflect.FieldUtils; 33 | import com.morgoo.helper.compat.IAudioServiceCompat; 34 | import com.morgoo.helper.compat.IInputMethodManagerCompat; 35 | 36 | /** 37 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/6/4. 38 | */ 39 | public class IInputMethodManagerBinderHook extends BinderHook { 40 | 41 | private final static String SERVICE_NAME = Context.INPUT_METHOD_SERVICE; 42 | 43 | public IInputMethodManagerBinderHook(Context hostContext) { 44 | super(hostContext); 45 | } 46 | 47 | @Override 48 | public Object getOldObj() throws Exception { 49 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 50 | return IInputMethodManagerCompat.asInterface(iBinder); 51 | } 52 | 53 | @Override 54 | protected void onInstall(ClassLoader classLoader) throws Throwable { 55 | super.onInstall(classLoader); 56 | Object obj = FieldUtils.readStaticField(InputMethodManager.class, "sInstance"); 57 | if (obj != null) { 58 | FieldUtils.writeStaticField(InputMethodManager.class, "sInstance", null); 59 | } 60 | mHostContext.getSystemService(Context.INPUT_METHOD_SERVICE); 61 | } 62 | 63 | @Override 64 | public String getServiceName() { 65 | return SERVICE_NAME; 66 | } 67 | 68 | @Override 69 | protected BaseHookHandle createHookHandle() { 70 | return new IInputMethodManagerHookHandle(mHostContext); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/ILocationManagerBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | 28 | import com.morgoo.droidplugin.hook.BaseHookHandle; 29 | import com.morgoo.droidplugin.hook.handle.ILocationManagerHookHandle; 30 | import com.morgoo.helper.compat.ILocationManagerCompat; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2016/2/25. 34 | */ 35 | public class ILocationManagerBinderHook extends BinderHook { 36 | 37 | 38 | private final static String SERVICE_NAME = Context.LOCATION_SERVICE; 39 | 40 | public ILocationManagerBinderHook(Context hostContext) { 41 | super(hostContext); 42 | } 43 | 44 | @Override 45 | Object getOldObj() throws Exception { 46 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 47 | return ILocationManagerCompat.asInterface(iBinder); 48 | } 49 | 50 | @Override 51 | public String getServiceName() { 52 | return SERVICE_NAME; 53 | } 54 | 55 | @Override 56 | protected BaseHookHandle createHookHandle() { 57 | return new ILocationManagerHookHandle(mHostContext); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/IMediaRouterServiceBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.handle.IMediaRouterServiceHookHandle; 29 | import com.morgoo.helper.compat.IMediaRouterServiceCompat; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/6. 33 | */ 34 | public class IMediaRouterServiceBinderHook extends BinderHook { 35 | private final static String SERVICE_NAME =Context.MEDIA_ROUTER_SERVICE; 36 | 37 | public IMediaRouterServiceBinderHook(Context hostContext) { 38 | super(hostContext); 39 | } 40 | 41 | @Override 42 | public Object getOldObj() throws Exception{ 43 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 44 | return IMediaRouterServiceCompat.asInterface(iBinder); 45 | } 46 | 47 | @Override 48 | public String getServiceName() { 49 | return SERVICE_NAME; 50 | } 51 | 52 | @Override 53 | protected BaseHookHandle createHookHandle() { 54 | return new IMediaRouterServiceHookHandle(mHostContext); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/IMountServiceBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.handle.IMountServiceHookHandle; 29 | import com.morgoo.helper.compat.IMountServiceCompat; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/6. 33 | */ 34 | public class IMountServiceBinderHook extends BinderHook { 35 | 36 | private final static String SERVICE_NAME = "mount"; 37 | 38 | public IMountServiceBinderHook(Context hostContext) { 39 | super(hostContext); 40 | } 41 | 42 | @Override 43 | public Object getOldObj() throws Exception{ 44 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 45 | return IMountServiceCompat.asInterface(iBinder); 46 | } 47 | 48 | @Override 49 | public String getServiceName() { 50 | return SERVICE_NAME; 51 | } 52 | 53 | @Override 54 | protected BaseHookHandle createHookHandle() { 55 | return new IMountServiceHookHandle(mHostContext); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/INotificationManagerBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.handle.INotificationManagerHookHandle; 29 | import com.morgoo.helper.compat.INotificationManagerCompat; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/2. 33 | */ 34 | public class INotificationManagerBinderHook extends BinderHook { 35 | 36 | public static final String SERVICE_NAME = "notification"; 37 | 38 | public INotificationManagerBinderHook(Context hostContext) { 39 | super(hostContext); 40 | } 41 | 42 | @Override 43 | protected BaseHookHandle createHookHandle() { 44 | return new INotificationManagerHookHandle(mHostContext); 45 | } 46 | 47 | public Object getOldObj() throws Exception{ 48 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 49 | return INotificationManagerCompat.asInterface(iBinder); 50 | } 51 | 52 | public String getServiceName() { 53 | return SERVICE_NAME; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/ISearchManagerBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | package com.morgoo.droidplugin.hook.binder; 23 | 24 | import android.content.Context; 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.handle.IClipboardHookHandle; 29 | import com.morgoo.droidplugin.hook.handle.ISearchManagerHookHandle; 30 | import com.morgoo.helper.compat.ISearchManagerCompat; 31 | 32 | /** 33 | * Created by wyw on 15-9-18. 34 | */ 35 | public class ISearchManagerBinderHook extends BinderHook { 36 | 37 | private final static String SEARCH_MANAGER_SERVICE = "search"; 38 | 39 | public ISearchManagerBinderHook(Context hostContext) { 40 | super(hostContext); 41 | } 42 | 43 | @Override 44 | Object getOldObj() throws Exception { 45 | IBinder iBinder = MyServiceManager.getOriginService(SEARCH_MANAGER_SERVICE); 46 | return ISearchManagerCompat.asInterface(iBinder); 47 | } 48 | 49 | @Override 50 | public String getServiceName() { 51 | return SEARCH_MANAGER_SERVICE; 52 | } 53 | 54 | @Override 55 | protected BaseHookHandle createHookHandle() { 56 | return new ISearchManagerHookHandle(mHostContext); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/ISessionManagerBinderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.content.Context; 26 | import android.os.IBinder; 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.handle.ISessionManagerHookHandle; 29 | import com.morgoo.helper.compat.ISessionManagerCompat; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/9. 33 | */ 34 | public class ISessionManagerBinderHook extends BinderHook { 35 | private final static String SERVICE_NAME = Context.MEDIA_SESSION_SERVICE; 36 | 37 | public ISessionManagerBinderHook(Context hostContext) { 38 | super(hostContext); 39 | } 40 | 41 | @Override 42 | public Object getOldObj() throws Exception{ 43 | IBinder iBinder = MyServiceManager.getOriginService(SERVICE_NAME); 44 | return ISessionManagerCompat.asInterface(iBinder); 45 | } 46 | 47 | @Override 48 | public String getServiceName() { 49 | return SERVICE_NAME; 50 | } 51 | 52 | @Override 53 | protected BaseHookHandle createHookHandle() { 54 | return new ISessionManagerHookHandle(mHostContext); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/binder/MyServiceManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.binder; 24 | 25 | import android.os.IBinder; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | /** 31 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/2. 32 | */ 33 | public class MyServiceManager { 34 | 35 | private static Map mOriginServiceCache = new HashMap(1); 36 | private static Map mProxiedServiceCache = new HashMap(1); 37 | private static Map mProxiedObjCache = new HashMap(1); 38 | 39 | static IBinder getOriginService(String serviceName) { 40 | return mOriginServiceCache.get(serviceName); 41 | } 42 | 43 | public static void addOriginService(String serviceName, IBinder service) { 44 | mOriginServiceCache.put(serviceName, service); 45 | } 46 | 47 | static void addProxiedServiceCache(String serviceName, IBinder proxyService) { 48 | mProxiedServiceCache.put(serviceName, proxyService); 49 | } 50 | 51 | static Object getProxiedObj(String servicename) { 52 | return mProxiedObjCache.get(servicename); 53 | } 54 | 55 | static void addProxiedObj(String servicename, Object obj) { 56 | mProxiedObjCache.put(servicename, obj); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/handle/IGraphicsStatsHookHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.handle; 24 | 25 | import android.content.Context; 26 | import android.text.TextUtils; 27 | 28 | import com.morgoo.droidplugin.hook.BaseHookHandle; 29 | import com.morgoo.droidplugin.hook.HookedMethodHandler; 30 | 31 | import java.lang.reflect.Method; 32 | 33 | /** 34 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/6/18. 35 | */ 36 | public class IGraphicsStatsHookHandle extends BaseHookHandle { 37 | public IGraphicsStatsHookHandle(Context hostContext) { 38 | super(hostContext); 39 | } 40 | 41 | @Override 42 | protected void init() { 43 | sHookedMethodHandlers.put("requestBufferForProcess", new requestBufferForProcess(mHostContext)); 44 | } 45 | 46 | private class requestBufferForProcess extends HookedMethodHandler { 47 | public requestBufferForProcess(Context hostContext) { 48 | super(hostContext); 49 | } 50 | 51 | @Override 52 | protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable { 53 | int index = 0; 54 | if (args != null && args.length > index && args[index] instanceof String) { 55 | String pkg = ((String) args[index]); 56 | if (!TextUtils.equals(pkg, mHostContext.getPackageName())) { 57 | args[index] = mHostContext.getPackageName(); 58 | } 59 | } 60 | return super.beforeInvoke(receiver, method, args); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/handle/IMediaRouterServiceHookHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.handle; 24 | 25 | import android.content.Context; 26 | import android.text.TextUtils; 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.HookedMethodHandler; 29 | 30 | import java.lang.reflect.Method; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/6. 34 | */ 35 | public class IMediaRouterServiceHookHandle extends BaseHookHandle { 36 | 37 | public IMediaRouterServiceHookHandle(Context hostContext) { 38 | super(hostContext); 39 | } 40 | 41 | @Override 42 | protected void init() { 43 | // public void registerClientAsUser(IMediaRouterClient client, String packageName, int userId); 44 | // public void unregisterClient(IMediaRouterClient client); 45 | // public MediaRouterClientState getState(IMediaRouterClient client); 46 | // public void setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan); 47 | // public void setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit); 48 | // public void requestSetVolume(IMediaRouterClient client, String routeId, int volume); 49 | // public void requestUpdateVolume(IMediaRouterClient client, String routeId, int direction); 50 | sHookedMethodHandlers.put("registerClientAsUser", new registerClientAsUser(mHostContext)); 51 | } 52 | 53 | 54 | private class registerClientAsUser extends HookedMethodHandler { 55 | public registerClientAsUser(Context context) { 56 | super(context); 57 | } 58 | 59 | @Override 60 | protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable { 61 | int index = 1; 62 | if (args != null && args.length > index && args[index] instanceof String) { 63 | String pkg = (String) args[index]; 64 | if (!TextUtils.equals(pkg, mHostContext.getPackageName())) { 65 | args[index] = mHostContext.getPackageName(); 66 | } 67 | } 68 | return super.beforeInvoke(receiver, method, args); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/handle/ISearchManagerHookHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | package com.morgoo.droidplugin.hook.handle; 23 | 24 | import android.content.ComponentName; 25 | import android.content.Context; 26 | import android.content.pm.ActivityInfo; 27 | import android.text.TextUtils; 28 | 29 | import com.morgoo.droidplugin.hook.BaseHookHandle; 30 | import com.morgoo.droidplugin.hook.HookedMethodHandler; 31 | import com.morgoo.droidplugin.pm.PluginManager; 32 | import com.morgoo.helper.Log; 33 | 34 | import java.lang.reflect.Method; 35 | 36 | /** 37 | * Created by wyw on 15-9-18. 38 | */ 39 | public class ISearchManagerHookHandle extends BaseHookHandle { 40 | 41 | public ISearchManagerHookHandle(Context context) { 42 | super(context); 43 | } 44 | @Override 45 | protected void init() { 46 | sHookedMethodHandlers.put("getSearchableInfo", new getSearchableInfo(mHostContext)); 47 | 48 | } 49 | 50 | private class getSearchableInfo extends HookedMethodHandler{ 51 | 52 | public getSearchableInfo(Context hostContext) { 53 | super(hostContext); 54 | } 55 | 56 | @Override 57 | protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable { 58 | if (args != null && args.length > 0 && args[args.length - 1] instanceof ComponentName) { 59 | ComponentName cpn = (ComponentName) args[args.length - 1]; 60 | ActivityInfo info = PluginManager.getInstance().getActivityInfo(cpn, 0); 61 | if (info != null) { 62 | ActivityInfo proxyInfo = PluginManager.getInstance().selectStubActivityInfo(info); 63 | if (proxyInfo != null) { 64 | args[args.length - 1] = new ComponentName(proxyInfo.packageName, proxyInfo.name); 65 | } 66 | } 67 | } 68 | return super.beforeInvoke(receiver, method, args); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/handle/ISessionManagerHookHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.handle; 24 | 25 | import android.content.Context; 26 | import android.text.TextUtils; 27 | import com.morgoo.droidplugin.hook.BaseHookHandle; 28 | import com.morgoo.droidplugin.hook.HookedMethodHandler; 29 | 30 | import java.lang.reflect.Method; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/9. 34 | */ 35 | public class ISessionManagerHookHandle extends BaseHookHandle { 36 | 37 | public ISessionManagerHookHandle(Context context) { 38 | super(context); 39 | } 40 | 41 | @Override 42 | protected void init() { 43 | sHookedMethodHandlers.put("createSession", new createSession(mHostContext)); 44 | } 45 | 46 | private class createSession extends HookedMethodHandler { 47 | public createSession(Context context) { 48 | super(context); 49 | } 50 | 51 | @Override 52 | protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable { 53 | int index = 0; 54 | if (args != null && args.length > index && args[index] instanceof String) { 55 | String pkg = (String) args[index]; 56 | if (!TextUtils.equals(pkg, mHostContext.getPackageName())) { 57 | args[index] = mHostContext.getPackageName(); 58 | } 59 | } 60 | return super.beforeInvoke(receiver, method, args); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/handle/ReplaceCallingPackageHookedMethodHandler.java: -------------------------------------------------------------------------------- 1 | package com.morgoo.droidplugin.hook.handle; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.os.RemoteException; 6 | 7 | import com.morgoo.droidplugin.hook.HookedMethodHandler; 8 | import com.morgoo.droidplugin.pm.PluginManager; 9 | 10 | import java.lang.reflect.Method; 11 | 12 | class ReplaceCallingPackageHookedMethodHandler extends HookedMethodHandler { 13 | 14 | public ReplaceCallingPackageHookedMethodHandler(Context hostContext) { 15 | super(hostContext); 16 | } 17 | 18 | @Override 19 | protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable { 20 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { 21 | if (args != null && args.length > 0) { 22 | for (int index = 0; index < args.length; index++) { 23 | if (args[index] != null && (args[index] instanceof String)) { 24 | String str = ((String) args[index]); 25 | if (isPackagePlugin(str)) { 26 | args[index] = mHostContext.getPackageName(); 27 | } 28 | } 29 | } 30 | } 31 | } 32 | return super.beforeInvoke(receiver, method, args); 33 | } 34 | 35 | private static boolean isPackagePlugin(String packageName) throws RemoteException { 36 | return PluginManager.getInstance().isPluginPackage(packageName); 37 | } 38 | } -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/proxy/IContentProviderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.proxy; 24 | 25 | import android.content.Context; 26 | import android.content.pm.ProviderInfo; 27 | 28 | import com.morgoo.droidplugin.hook.BaseHookHandle; 29 | import com.morgoo.droidplugin.hook.handle.IContentProviderInvokeHandle; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/6. 33 | */ 34 | public class IContentProviderHook extends ProxyHook { 35 | 36 | 37 | private final ProviderInfo mStubProvider; 38 | private final ProviderInfo mTargetProvider; 39 | private final boolean mLocalProvider; 40 | 41 | 42 | public IContentProviderHook(Context context, Object oldObj, ProviderInfo stubProvider, ProviderInfo targetProvider, boolean localProvider) { 43 | super(context); 44 | setOldObj(oldObj); 45 | mStubProvider = stubProvider; 46 | mTargetProvider = targetProvider; 47 | mLocalProvider = localProvider; 48 | mHookHandles = createHookHandle(); 49 | 50 | } 51 | 52 | @Override 53 | protected BaseHookHandle createHookHandle() { 54 | return new IContentProviderInvokeHandle(mHostContext, mStubProvider, mTargetProvider, mLocalProvider); 55 | } 56 | 57 | @Override 58 | protected void onInstall(ClassLoader classLoader) throws Throwable { 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/proxy/IWindowSessionHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.proxy; 24 | 25 | import android.content.Context; 26 | import android.content.pm.ProviderInfo; 27 | 28 | import com.morgoo.droidplugin.hook.BaseHookHandle; 29 | import com.morgoo.droidplugin.hook.handle.IContentProviderInvokeHandle; 30 | import com.morgoo.droidplugin.hook.handle.IWindowSessionInvokeHandle; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/6. 34 | */ 35 | public class IWindowSessionHook extends ProxyHook { 36 | 37 | 38 | 39 | public IWindowSessionHook(Context context, Object oldObj) { 40 | super(context); 41 | setOldObj(oldObj); 42 | mHookHandles = createHookHandle(); 43 | 44 | } 45 | 46 | @Override 47 | protected BaseHookHandle createHookHandle() { 48 | return new IWindowSessionInvokeHandle(mHostContext); 49 | } 50 | 51 | @Override 52 | protected void onInstall(ClassLoader classLoader) throws Throwable { 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/hook/proxy/WebViewFactoryProviderHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.hook.proxy; 24 | 25 | import android.content.Context; 26 | import android.os.Build; 27 | import android.webkit.WebView; 28 | 29 | import com.morgoo.droidplugin.hook.BaseHookHandle; 30 | import com.morgoo.droidplugin.hook.HookedMethodHandler; 31 | import com.morgoo.droidplugin.hook.handle.WebViewFactoryProviderHookHandle; 32 | import com.morgoo.droidplugin.reflect.FieldUtils; 33 | import com.morgoo.droidplugin.reflect.MethodUtils; 34 | import com.morgoo.droidplugin.reflect.Utils; 35 | import com.morgoo.helper.MyProxy; 36 | import com.morgoo.helper.compat.WebViewFactoryCompat; 37 | 38 | import java.lang.reflect.InvocationHandler; 39 | import java.lang.reflect.Method; 40 | import java.util.List; 41 | 42 | /** 43 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2014/10/10. 44 | */ 45 | public class WebViewFactoryProviderHook extends ProxyHook { 46 | 47 | public WebViewFactoryProviderHook(Context hostContext) { 48 | super(hostContext); 49 | } 50 | 51 | @Override 52 | protected BaseHookHandle createHookHandle() { 53 | return new WebViewFactoryProviderHookHandle(mHostContext); 54 | } 55 | 56 | @Override 57 | protected void onInstall(ClassLoader classLoader) throws Throwable { 58 | mOldObj = WebViewFactoryCompat.getProvider(); 59 | Class clazz = mOldObj.getClass(); 60 | List> interfaces = Utils.getAllInterfaces(clazz); 61 | Class[] ifs = interfaces != null && interfaces.size() > 0 ? interfaces.toArray(new Class[interfaces.size()]) : new Class[0]; 62 | Object newObj = MyProxy.newProxyInstance(clazz.getClassLoader(), ifs, this); 63 | FieldUtils.writeStaticField(WebViewFactoryCompat.Class(), "sProviderInstance", newObj); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/pm/IApplicationCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | 24 | 25 | package com.morgoo.droidplugin.pm; 26 | 27 | /** 28 | * API for package data change related callbacks from the Package Manager. 29 | * Some usage scenarios include deletion of cache directory, generate 30 | * statistics related to code, data, cache usage 31 | * {@hide} 32 | */ 33 | interface IApplicationCallback { 34 | Bundle onCallback(in Bundle extra); 35 | } 36 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/pm/IPackageDataObserver.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.pm; 24 | 25 | /** 26 | * API for package data change related callbacks from the Package Manager. 27 | * Some usage scenarios include deletion of cache directory, generate 28 | * statistics related to code, data, cache usage 29 | */ 30 | oneway interface IPackageDataObserver { 31 | void onRemoveCompleted(in String packageName, boolean succeeded); 32 | } 33 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/pm/parser/PackageParserApi20.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.pm.parser; 24 | 25 | import android.annotation.TargetApi; 26 | import android.content.Context; 27 | import android.os.Build; 28 | import android.util.DisplayMetrics; 29 | import com.morgoo.droidplugin.reflect.MethodUtils; 30 | 31 | import java.io.File; 32 | 33 | /** 34 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/2/13. 35 | */ 36 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) 37 | class PackageParserApi20 extends PackageParserApi21 { 38 | 39 | 40 | public PackageParserApi20(Context context) throws Exception { 41 | super(context); 42 | } 43 | 44 | @Override 45 | public void parsePackage(File sourceFile, int flags) throws Exception { 46 | /* public Package parsePackage(File sourceFile, String destCodePath, 47 | DisplayMetrics metrics, int flags)*/ 48 | DisplayMetrics metrics = new DisplayMetrics(); 49 | metrics.setToDefaults(); 50 | String destCodePath = sourceFile.getPath(); 51 | mPackageParser = MethodUtils.invokeConstructor(sPackageParserClass, destCodePath); 52 | mPackage = MethodUtils.invokeMethod(mPackageParser, "parsePackage", sourceFile, destCodePath, metrics, flags); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/pm/parser/PackageParserApi22Preview1.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.pm.parser; 24 | 25 | import android.content.Context; 26 | import android.content.pm.PackageInfo; 27 | 28 | import com.morgoo.droidplugin.reflect.MethodUtils; 29 | import com.morgoo.helper.Log; 30 | 31 | import java.lang.reflect.Method; 32 | import java.util.Arrays; 33 | import java.util.HashSet; 34 | import java.util.Set; 35 | 36 | /** 37 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/29. 38 | */ 39 | //for Android M 40 | class PackageParserApi22Preview1 extends PackageParserApi21 { 41 | 42 | 43 | private static final String TAG = PackageParserApi22Preview1.class.getSimpleName(); 44 | 45 | PackageParserApi22Preview1(Context context) throws Exception { 46 | super(context); 47 | } 48 | 49 | @Override 50 | public PackageInfo generatePackageInfo( 51 | int gids[], int flags, long firstInstallTime, long lastUpdateTime, 52 | HashSet grantedPermissions) throws Exception { 53 | /*public static PackageInfo generatePackageInfo(PackageParser.Package p, 54 | int gids[], int flags, long firstInstallTime, long lastUpdateTime, 55 | HashSet grantedPermissions, PackageUserState state, int userId) */ 56 | try { 57 | return super.generatePackageInfo(gids, flags, firstInstallTime, lastUpdateTime, grantedPermissions); 58 | } catch (Exception e) { 59 | Log.i(TAG, "generatePackageInfo fail", e); 60 | } 61 | Method method = MethodUtils.getAccessibleMethod(sPackageParserClass, "generatePackageInfo", 62 | mPackage.getClass(), 63 | int[].class, int.class, long.class, long.class, Set.class, sPackageUserStateClass, int.class); 64 | return (PackageInfo) method.invoke(null, mPackage, gids, flags, firstInstallTime, lastUpdateTime, grantedPermissions, mDefaultPackageUserState, mUserId); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/reflect/Validate.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.reflect; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com)ClassUtils on 2015/3/26. 27 | */ 28 | class Validate { 29 | 30 | static void isTrue(final boolean expression, final String message, final Object... values) { 31 | if (expression == false) { 32 | throw new IllegalArgumentException(String.format(message, values)); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/stub/ContentProviderStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.stub; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/2/12. 27 | */ 28 | public abstract class ContentProviderStub extends AbstractContentProviderStub { 29 | 30 | public static class StubP00 extends ContentProviderStub { 31 | } 32 | 33 | public static class StubP01 extends ContentProviderStub { 34 | } 35 | 36 | public static class StubP02 extends ContentProviderStub { 37 | } 38 | 39 | public static class StubP03 extends ContentProviderStub { 40 | } 41 | 42 | public static class StubP04 extends ContentProviderStub { 43 | } 44 | 45 | public static class StubP05 extends ContentProviderStub { 46 | } 47 | 48 | public static class StubP06 extends ContentProviderStub { 49 | } 50 | 51 | public static class StubP07 extends ContentProviderStub { 52 | } 53 | 54 | public static class StubP08 extends ContentProviderStub { 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/stub/MyFakeIBinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.droidplugin.stub; 24 | 25 | import android.os.IBinder; 26 | import android.os.IInterface; 27 | import android.os.Parcel; 28 | import android.os.RemoteException; 29 | 30 | import java.io.FileDescriptor; 31 | 32 | /** 33 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/4. 34 | */ 35 | public class MyFakeIBinder implements IBinder { 36 | 37 | @Override 38 | public String getInterfaceDescriptor() throws RemoteException { 39 | return null; 40 | } 41 | 42 | @Override 43 | public boolean pingBinder() { 44 | return false; 45 | } 46 | 47 | @Override 48 | public boolean isBinderAlive() { 49 | return false; 50 | } 51 | 52 | @Override 53 | public IInterface queryLocalInterface(String s) { 54 | return null; 55 | } 56 | 57 | @Override 58 | public void dump(FileDescriptor fileDescriptor, String[] strings) throws RemoteException { 59 | 60 | } 61 | 62 | @Override 63 | public void dumpAsync(FileDescriptor fileDescriptor, String[] strings) throws RemoteException { 64 | 65 | } 66 | 67 | @Override 68 | public boolean transact(int i, Parcel parcel, Parcel parcel1, int i1) throws RemoteException { 69 | return false; 70 | } 71 | 72 | @Override 73 | public void linkToDeath(DeathRecipient deathRecipient, int i) throws RemoteException { 74 | 75 | } 76 | 77 | @Override 78 | public boolean unlinkToDeath(DeathRecipient deathRecipient, int i) { 79 | return false; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/droidplugin/stub/ServiceStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** copyright (c) 2015 Andy Zhang(Zhangyong232@gmail.com) 3 | ** 4 | ** This file is part of DroidPlugin. 5 | ** 6 | ** DroidPlugin is free software: you can redistribute it and/or 7 | ** modify it under the terms of the GNU Lesser General Public 8 | ** License as published by the Free Software Foundation, either 9 | ** version 3 of the License, or (at your option) any later version. 10 | ** 11 | ** DroidPlugin is distributed in the hope that it will be useful, 12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ** Lesser General Public License for more details. 15 | ** 16 | ** You should have received a copy of the GNU Lesser General Public 17 | ** License along with DroidPlugin. If not, see 18 | ** 19 | **/ 20 | 21 | package com.morgoo.droidplugin.stub; 22 | 23 | /** 24 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/2/9. 25 | */ 26 | public abstract class ServiceStub extends AbstractServiceStub { 27 | 28 | 29 | public abstract static class StubP00 extends ServiceStub { 30 | public static class P00 extends StubP00 { 31 | } 32 | } 33 | 34 | public abstract static class StubP01 extends ServiceStub { 35 | public static class P00 extends StubP01 { 36 | } 37 | } 38 | 39 | public abstract static class StubP02 extends ServiceStub { 40 | public static class P00 extends StubP01 { 41 | } 42 | } 43 | 44 | public abstract static class StubP03 extends ServiceStub { 45 | public static class P00 extends StubP01 { 46 | } 47 | } 48 | 49 | public abstract static class StubP04 extends ServiceStub { 50 | public static class P00 extends StubP01 { 51 | } 52 | } 53 | 54 | public abstract static class StubP05 extends ServiceStub { 55 | public static class P00 extends StubP01 { 56 | } 57 | } 58 | 59 | public abstract static class StubP06 extends ServiceStub { 60 | public static class P00 extends StubP01 { 61 | } 62 | } 63 | 64 | public abstract static class StubP07 extends ServiceStub { 65 | public static class P00 extends StubP01 { 66 | } 67 | } 68 | 69 | public abstract static class StubP08 extends ServiceStub { 70 | public static class P00 extends StubP01 { 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/ComponentNameComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper; 24 | 25 | import android.content.ComponentName; 26 | import android.text.TextUtils; 27 | 28 | import java.util.Comparator; 29 | 30 | public class ComponentNameComparator implements Comparator { 31 | 32 | @Override 33 | public int compare(ComponentName lhs, ComponentName rhs) { 34 | if (lhs == null && rhs == null) { 35 | return 0; 36 | } else if (lhs != null && rhs == null) { 37 | return 1; 38 | } else if (lhs == null && rhs != null) { 39 | return -1; 40 | } else { 41 | if (TextUtils.equals(lhs.getPackageName(), rhs.getPackageName()) && TextUtils.equals(lhs.getShortClassName(), rhs.getShortClassName())) { 42 | return 0; 43 | } else { 44 | return lhs.compareTo(rhs); 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ActivityManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/4/13. 27 | */ 28 | public class ActivityManagerCompat { 29 | public static final int INTENT_SENDER_SERVICE = 4; 30 | 31 | public static final int INTENT_SENDER_ACTIVITY = 2; 32 | } 33 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ActivityManagerNativeCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import com.morgoo.droidplugin.reflect.MethodUtils; 26 | 27 | import java.lang.reflect.InvocationTargetException; 28 | 29 | /** 30 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/1. 31 | */ 32 | public class ActivityManagerNativeCompat { 33 | 34 | private static Class sClass; 35 | 36 | public static Class Class() throws ClassNotFoundException { 37 | if (sClass == null) { 38 | sClass = Class.forName("android.app.ActivityManagerNative"); 39 | } 40 | return sClass; 41 | } 42 | 43 | public static Object getDefault() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 44 | return MethodUtils.invokeStaticMethod(Class(), "getDefault"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/CompatibilityInfoCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import com.morgoo.droidplugin.reflect.FieldUtils; 26 | 27 | /** 28 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/1. 29 | */ 30 | public class CompatibilityInfoCompat { 31 | 32 | private static Class sClass; 33 | 34 | private static Class getMyClass() throws ClassNotFoundException { 35 | if (sClass == null) { 36 | sClass = Class.forName("android.content.res.CompatibilityInfo"); 37 | } 38 | return sClass; 39 | } 40 | 41 | private static Object sDefaultCompatibilityInfo; 42 | 43 | public static Object DEFAULT_COMPATIBILITY_INFO() throws IllegalAccessException, ClassNotFoundException { 44 | if (sDefaultCompatibilityInfo==null) { 45 | sDefaultCompatibilityInfo = FieldUtils.readStaticField(getMyClass(), "DEFAULT_COMPATIBILITY_INFO"); 46 | } 47 | return sDefaultCompatibilityInfo; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ContentProviderHolderCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.content.pm.ProviderInfo; 26 | 27 | import java.lang.reflect.Constructor; 28 | import java.lang.reflect.InvocationTargetException; 29 | 30 | /** 31 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 32 | */ 33 | public class ContentProviderHolderCompat { 34 | 35 | private static Class sClass; 36 | 37 | public static Class Class() throws ClassNotFoundException { 38 | if (sClass == null) { 39 | sClass = Class.forName("android.app.IActivityManager$ContentProviderHolder"); 40 | } 41 | return sClass; 42 | } 43 | 44 | public static Object newInstance(Object target) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException { 45 | Class clazz = Class(); 46 | Constructor constructor = clazz.getConstructor(ProviderInfo.class); 47 | return constructor.newInstance(target); 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IActivityManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/1. 27 | */ 28 | public class IActivityManagerCompat { 29 | 30 | private static Class sClass; 31 | 32 | public static Class Class() throws ClassNotFoundException { 33 | if (sClass == null) { 34 | sClass = Class.forName("android.app.IActivityManager"); 35 | } 36 | return sClass; 37 | } 38 | 39 | public static boolean isIActivityManager(Object obj){ 40 | if (obj == null) { 41 | return false; 42 | } else { 43 | try { 44 | Class clazz = Class(); 45 | return clazz.isInstance(obj); 46 | } catch (ClassNotFoundException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IAudioServiceCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 33 | */ 34 | public class IAudioServiceCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.media.IAudioService"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.media.IAudioService$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IClipboardCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 33 | */ 34 | public class IClipboardCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.content.IClipboard"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.content.IClipboard$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IContentServiceCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/21. 33 | */ 34 | public class IContentServiceCompat { 35 | 36 | 37 | private static Class sClass; 38 | 39 | public static Class Class() throws ClassNotFoundException { 40 | if (sClass == null) { 41 | sClass = Class.forName("android.content.IContentService"); 42 | } 43 | return sClass; 44 | } 45 | 46 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 47 | Class clazz = Class.forName("android.content.IContentService$Stub"); 48 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IGraphicsStatsCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/6/18. 33 | */ 34 | public class IGraphicsStatsCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.view.IGraphicsStats"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.view.IGraphicsStats$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IInputMethodManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 33 | */ 34 | public class IInputMethodManagerCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("com.android.internal.view.IInputMethodManager"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("com.android.internal.view.IInputMethodManager$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ILocationManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2016/2/25. 33 | */ 34 | public class ILocationManagerCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.location.ILocationManager"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.location.ILocationManager$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IMediaRouterServiceCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 33 | */ 34 | public class IMediaRouterServiceCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.media.IMediaRouterService"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.media.IMediaRouterService$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IMountServiceCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | package com.morgoo.helper.compat; 23 | 24 | import android.os.IBinder; 25 | 26 | import com.morgoo.droidplugin.reflect.MethodUtils; 27 | 28 | import java.lang.reflect.InvocationTargetException; 29 | 30 | /** 31 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 32 | */ 33 | public class IMountServiceCompat { 34 | 35 | private static Class sClass; 36 | 37 | public static Class Class() throws ClassNotFoundException { 38 | if (sClass == null) { 39 | sClass = Class.forName("android.os.storage.IMountService"); 40 | } 41 | return sClass; 42 | } 43 | 44 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 45 | Class clazz = Class.forName("android.os.storage.IMountService$Stub"); 46 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/INotificationManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 33 | */ 34 | public class INotificationManagerCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.app.INotificationManager"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.app.INotificationManager$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IPackageDataObserverCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 27 | */ 28 | public class IPackageDataObserverCompat { 29 | 30 | private static Class sClass; 31 | 32 | public static Class Class() throws ClassNotFoundException { 33 | if (sClass == null) { 34 | sClass = Class.forName("android.content.pm.IPackageDataObserver"); 35 | } 36 | return sClass; 37 | } 38 | 39 | public static boolean isIPackageDataObserver(Object obj) throws ClassNotFoundException { 40 | if (obj == null) { 41 | return false; 42 | } else { 43 | Class clazz = Class(); 44 | return clazz.isInstance(obj); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ISearchManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | package com.morgoo.helper.compat; 23 | 24 | import android.os.IBinder; 25 | 26 | import com.morgoo.droidplugin.reflect.MethodUtils; 27 | 28 | import java.lang.reflect.InvocationTargetException; 29 | 30 | /** 31 | * Created by wyw on 15-9-18. 32 | */ 33 | public class ISearchManagerCompat { 34 | 35 | private static Class sClass; 36 | 37 | public static Class Class() throws ClassNotFoundException { 38 | if (sClass == null) { 39 | sClass = Class.forName("android.app.ISearchManager"); 40 | } 41 | return sClass; 42 | } 43 | 44 | public static Object asInterface(IBinder binder) throws ClassNotFoundException 45 | , NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.app.ISearchManager$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ISessionManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/1. 33 | */ 34 | public class ISessionManagerCompat { 35 | private static Class sClass; 36 | 37 | public static Class Class() throws ClassNotFoundException { 38 | if (sClass == null) { 39 | sClass = Class.forName("android.media.session.ISessionManager"); 40 | } 41 | return sClass; 42 | } 43 | 44 | public static Object asInterface(IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 45 | Class clazz = Class.forName("android.media.session.ISessionManager$Stub"); 46 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IWifiManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/6/1. 33 | */ 34 | public class IWifiManagerCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.net.wifi.IWifiManager"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface(IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.net.wifi.IWifiManager$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/IWindowManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/6/17. 33 | */ 34 | public class IWindowManagerCompat { 35 | 36 | private static Class sClass; 37 | 38 | public static Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.view.IWindowManager"); 41 | } 42 | return sClass; 43 | } 44 | 45 | public static Object asInterface( IBinder binder) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 46 | Class clazz = Class.forName("android.view.IWindowManager$Stub"); 47 | return MethodUtils.invokeStaticMethod(clazz, "asInterface", binder); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/PackageManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/4/13. 27 | */ 28 | public class PackageManagerCompat { 29 | public static final int DELETE_FAILED_INTERNAL_ERROR = -1; 30 | public static final int DELETE_SUCCEEDED = 1; 31 | public static final int INSTALL_SUCCEEDED = 1; 32 | public static final int INSTALL_FAILED_INTERNAL_ERROR = -110; 33 | public static final int INSTALL_FAILED_INVALID_APK = -2; 34 | public static final int INSTALL_REPLACE_EXISTING = 0x00000002; 35 | public static final int INSTALL_FAILED_ALREADY_EXISTS = -1; 36 | } 37 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ParceledListSliceCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | /** 26 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 27 | */ 28 | public class ParceledListSliceCompat { 29 | 30 | private static Class sClass; 31 | 32 | public static Class Class() throws ClassNotFoundException { 33 | if (sClass == null) { 34 | sClass = Class.forName("android.content.pm.ParceledListSlice"); 35 | } 36 | return sClass; 37 | } 38 | 39 | public static boolean isParceledListSlice(Object obj){ 40 | if (obj == null) { 41 | return false; 42 | } else { 43 | try { 44 | Class clazz = Class(); 45 | return clazz.isInstance(obj); 46 | } catch (ClassNotFoundException e) { 47 | return false; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ProcessCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import com.morgoo.droidplugin.reflect.MethodUtils; 26 | 27 | import java.lang.reflect.InvocationTargetException; 28 | 29 | /** 30 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/3/14. 31 | */ 32 | public class ProcessCompat { 33 | 34 | public static final void setArgV0(String name) { 35 | try { 36 | MethodUtils.invokeStaticMethod(Class.forName("android.os.Process"), "setArgV0", name); 37 | } catch (NoSuchMethodException e) { 38 | e.printStackTrace(); 39 | } catch (IllegalAccessException e) { 40 | e.printStackTrace(); 41 | } catch (InvocationTargetException e) { 42 | e.printStackTrace(); 43 | } catch (ClassNotFoundException e) { 44 | e.printStackTrace(); 45 | } 46 | // android.os.Process.setArgV0(name); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/QueuedWorkCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import com.morgoo.droidplugin.reflect.MethodUtils; 26 | 27 | import java.lang.reflect.InvocationTargetException; 28 | 29 | /** 30 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/1. 31 | */ 32 | public class QueuedWorkCompat { 33 | 34 | private static Class sClass; 35 | 36 | private static Class Class() throws ClassNotFoundException { 37 | if (sClass == null) { 38 | sClass = Class.forName("android.app.QueuedWork"); 39 | } 40 | return sClass; 41 | } 42 | 43 | public static void waitToFinish() { 44 | try { 45 | MethodUtils.invokeStaticMethod(Class(), "waitToFinish"); 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/ServiceManagerCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.IBinder; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/4/13. 33 | */ 34 | public class ServiceManagerCompat { 35 | 36 | private static Class sClass = null; 37 | 38 | public static final Class Class() throws ClassNotFoundException { 39 | if (sClass == null) { 40 | sClass = Class.forName("android.os.ServiceManager"); 41 | } 42 | return sClass; 43 | } 44 | 45 | 46 | public static IBinder getService(String name) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { 47 | return (IBinder) MethodUtils.invokeStaticMethod(Class(), "getService", name); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/SingletonCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import com.morgoo.droidplugin.reflect.MethodUtils; 26 | 27 | import java.lang.reflect.InvocationTargetException; 28 | 29 | /** 30 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/5/4. 31 | */ 32 | public class SingletonCompat { 33 | 34 | private static Class sClass; 35 | 36 | public static Class Class() throws ClassNotFoundException { 37 | if (sClass == null) { 38 | sClass = Class.forName("android.util.Singleton"); 39 | } 40 | return sClass; 41 | } 42 | 43 | public static boolean isSingleton(Object obj) { 44 | if (obj == null) { 45 | return false; 46 | } else { 47 | try { 48 | Class clazz = Class(); 49 | return clazz.isInstance(obj); 50 | } catch (ClassNotFoundException e) { 51 | return false; 52 | } 53 | } 54 | } 55 | 56 | 57 | public static Object get(Object targetSingleton) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { 58 | return MethodUtils.invokeMethod(targetSingleton, "get"); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/SystemPropertiesCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import com.morgoo.droidplugin.reflect.MethodUtils; 26 | 27 | import java.lang.reflect.InvocationTargetException; 28 | 29 | /** 30 | * Created by zhangyong on 15/5/1. 31 | */ 32 | public class SystemPropertiesCompat { 33 | 34 | private static Class sClass; 35 | 36 | private static Class getMyClass() throws ClassNotFoundException { 37 | if (sClass == null) { 38 | sClass = Class.forName("android.os.SystemProperties"); 39 | } 40 | return sClass; 41 | } 42 | 43 | private static String getInner(String key, String defaultValue) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException { 44 | Class clazz = getMyClass(); 45 | return (String) MethodUtils.invokeStaticMethod(clazz, "get", key, defaultValue); 46 | } 47 | 48 | public static String get(String key, String defaultValue) { 49 | try { 50 | return getInner(key, defaultValue); 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | return defaultValue; 54 | } 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/UserHandleCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.UserHandle; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | 29 | import java.lang.reflect.InvocationTargetException; 30 | 31 | /** 32 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2015/4/13. 33 | */ 34 | public class UserHandleCompat { 35 | 36 | // UserHandle.getCallingUserId() 37 | public static int getCallingUserId() { 38 | try { 39 | return (int) MethodUtils.invokeStaticMethod(UserHandle.class, "getCallingUserId"); 40 | } catch (Exception e) { 41 | e.printStackTrace(); 42 | } 43 | return 0; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/VMRuntimeCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import android.os.Build; 26 | 27 | import com.morgoo.droidplugin.reflect.MethodUtils; 28 | import com.morgoo.helper.Log; 29 | 30 | /** 31 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2016/2/4. 32 | */ 33 | public class VMRuntimeCompat { 34 | 35 | private static final String TAG = VMRuntimeCompat.class.getSimpleName(); 36 | 37 | public final static boolean is64Bit() { 38 | // dalvik.system.VMRuntime.getRuntime().is64Bit(); 39 | try { 40 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 41 | return false; 42 | } 43 | Class VMRuntime = Class.forName("dalvik.system.VMRuntime"); 44 | Object VMRuntimeObj = MethodUtils.invokeStaticMethod(VMRuntime, "getRuntime"); 45 | Object is64Bit = MethodUtils.invokeMethod(VMRuntimeObj, "is64Bit"); 46 | if (is64Bit instanceof Boolean) { 47 | return ((Boolean) is64Bit); 48 | } 49 | } catch (Throwable e) { 50 | Log.w(TAG, "is64Bit", e); 51 | } 52 | return false; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /project/Libraries/DroidPlugin/src/com/morgoo/helper/compat/WebViewFactoryCompat.java: -------------------------------------------------------------------------------- 1 | /* 2 | ** DroidPlugin Project 3 | ** 4 | ** Copyright(c) 2015 Andy Zhang 5 | ** 6 | ** This file is part of DroidPlugin. 7 | ** 8 | ** DroidPlugin is free software: you can redistribute it and/or 9 | ** modify it under the terms of the GNU Lesser General Public 10 | ** License as published by the Free Software Foundation, either 11 | ** version 3 of the License, or (at your option) any later version. 12 | ** 13 | ** DroidPlugin is distributed in the hope that it will be useful, 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ** Lesser General Public License for more details. 17 | ** 18 | ** You should have received a copy of the GNU Lesser General Public 19 | ** License along with DroidPlugin. If not, see 20 | ** 21 | **/ 22 | 23 | package com.morgoo.helper.compat; 24 | 25 | import java.lang.reflect.InvocationTargetException; 26 | import java.lang.reflect.Method; 27 | 28 | /** 29 | * Created by Andy Zhang(zhangyong232@gmail.com) on 2014/10/10. 30 | */ 31 | public class WebViewFactoryCompat { 32 | 33 | private static Class sClass; 34 | 35 | public static Class Class() throws ClassNotFoundException { 36 | if (sClass == null) { 37 | sClass = Class.forName("android.webkit.WebViewFactory"); 38 | } 39 | return sClass; 40 | } 41 | 42 | public static Object getProvider() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException { 43 | Method getProvider = Class().getDeclaredMethod("getProvider"); 44 | if (!getProvider.isAccessible()) { 45 | getProvider.setAccessible(true); 46 | } 47 | return getProvider.invoke(null); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /project/Test/ApiTest/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | dependencies { 4 | compile fileTree(include: '*.jar', dir: 'libs') 5 | compile 'com.android.support:support-v4:23.1.1' 6 | compile 'com.android.support:appcompat-v7:23.1.1' 7 | compile 'com.android.support:design:23.1.1' 8 | } 9 | 10 | android { 11 | compileSdkVersion rootProject.ext.compileSdkVersion 12 | buildToolsVersion rootProject.ext.buildToolsVersion 13 | 14 | defaultConfig { 15 | ndk { 16 | moduleName 'Test' 17 | stl 'stlport_static' 18 | abiFilters 'armeabi', 'armeabi-v7a', 'x86' 19 | ldLibs 'log' 20 | cFlags '-DMY_LOG_LEVEL=LOG_VERBOSE' 21 | } 22 | } 23 | sourceSets { 24 | main { 25 | manifest.srcFile 'AndroidManifest.xml' 26 | java.srcDirs = ['src'] 27 | resources.srcDirs = ['src'] 28 | aidl.srcDirs = ['src'] 29 | renderscript.srcDirs = ['src'] 30 | res.srcDirs = ['res'] 31 | assets.srcDirs = ['assets'] 32 | jni.srcDirs = ['jni'] 33 | jniLibs.srcDirs = ['libs'] 34 | 35 | } 36 | 37 | instrumentTest.setRoot('tests') 38 | debug.setRoot('build-types/debug') 39 | release.setRoot('build-types/release') 40 | } 41 | 42 | lintOptions { 43 | abortOnError false 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /project/Test/ApiTest/jni/Core.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "help/nativehelper/JNIHelp.h" 8 | #include "help/log.h" 9 | #include "HelperJni/HelperJni.h" 10 | 11 | #define NATIVE_CLASS "com/morgoo/nativec/NativeCHelper" 12 | 13 | int registerNativeMethodsAndSetup(JNIEnv* env) { 14 | jclass nativeClass = env->FindClass(NATIVE_CLASS); 15 | if (clearJniExpcetion(env, TAG) || !nativeClass) { 16 | LOGE(TAG, "Can not found %s", NATIVE_CLASS); 17 | return 0; 18 | } 19 | 20 | env->UnregisterNatives(nativeClass); 21 | 22 | tryRegisterNativeMethodsHelperJni(env, NATIVE_CLASS); 23 | return 0; 24 | } 25 | 26 | __BEGIN_DECLS 27 | jint JNI_OnLoad(JavaVM* vm, void* reserved) { 28 | JNIEnv* env; 29 | if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) { 30 | LOGE(TAG, "JavaVM::GetEnv() failed"); 31 | abort(); 32 | } 33 | registerNativeMethodsAndSetup(env); 34 | 35 | LOGE(TAG, "JNI_OnLoad OKAY(pid=%d,uid=%d) jvm_addr[0x%x],JNIEnv_addr[0x%x]", 36 | getpid(), getuid(), (uint32_t ) vm, (uint32_t ) env); 37 | return JNI_VERSION_1_6; 38 | } 39 | __END_DECLS 40 | -------------------------------------------------------------------------------- /project/Test/ApiTest/jni/HelperJni/HelperJni.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * HelperJni.cpp 3 | * 4 | * Created on: 2014年5月28日 5 | * Author: zhangyong6 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "help/nativehelper/JNIHelp.h" 19 | #include "help/log.h" 20 | #include "HelperJni/HelperJni.h" 21 | 22 | 23 | int nativePing(JNIEnv* env, jobject obj) { 24 | LOGE(TAG, "nativePing"); 25 | return 1986; 26 | } 27 | 28 | 29 | static JNINativeMethod gMethods[] = { 30 | NATIVE_METHOD((void*) nativePing,"nativePing", "()I" )}; 31 | 32 | int tryRegisterNativeMethodsHelperJni(JNIEnv* env, const char* clazzname) { 33 | if (!clazzname) { 34 | LOGW(TAG, "Can not fund class skip register native method"); 35 | return JNI_ERR; 36 | } 37 | return jniRegisterNativeMethods2(env, clazzname, gMethods, NELEM(gMethods)); 38 | } 39 | -------------------------------------------------------------------------------- /project/Test/ApiTest/jni/HelperJni/HelperJni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HelperJni.h 3 | * 4 | * Created on: 2014年5月28日 5 | * Author: zhangyong6 6 | */ 7 | 8 | #ifndef HELPERJNI_H_ 9 | #define HELPERJNI_H_ 10 | 11 | #include 12 | 13 | int tryRegisterNativeMethodsHelperJni(JNIEnv* env, const char* clazz); 14 | 15 | inline bool clearJniExpcetion(JNIEnv* env, const char *tag, const char* func, 16 | int line) { 17 | if (env->ExceptionCheck()) { 18 | jthrowable exception = env->ExceptionOccurred(); 19 | if (exception) { 20 | jniLogException(env, ANDROID_LOG_ERROR, tag, exception); 21 | } 22 | env->ExceptionClear(); 23 | return true; 24 | } 25 | return false; 26 | } 27 | 28 | #endif /* HELPERJNI_H_ */ 29 | -------------------------------------------------------------------------------- /project/Test/ApiTest/jni/help/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * log.h 3 | * 4 | * Created on: 2013年12月4日 5 | * Author: zhangyong232@gmail.com 6 | */ 7 | 8 | #ifndef __LOG_H__ 9 | #define __LOG_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | __BEGIN_DECLS 17 | 18 | #define LOG_VERBOSE 1 19 | #define LOG_DEBUG 2 20 | #define LOG_INFO 3 21 | #define LOG_WARNING 4 22 | #define LOG_ERROR 5 23 | #define LOG_FATAL 6 24 | #define LOG_SILENT 7 25 | 26 | #ifndef MY_LOG_LEVEL 27 | #define MY_LOG_LEVEL LOG_SILENT 28 | #endif 29 | 30 | ///是否打开日志开关 31 | #ifndef DEBUG 32 | #define DEBUG MY_LOG_LEVEL 33 | #endif 34 | 35 | #ifndef CURRENT_FILENAME 36 | #define CURRENT_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 37 | #endif 38 | 39 | //默认的日志tag "NdkNative[Test.cpp(main):25]" 40 | #ifndef TAG 41 | #define TAG \ 42 | CURRENT_FILENAME,__FUNCTION__,__LINE__ 43 | #endif 44 | 45 | inline void android_log_print(int prio, const char *file, const char* func, 46 | int line, const char *fmt, ...) { 47 | va_list args; 48 | va_start(args, fmt); 49 | 50 | char buf[1024]; 51 | snprintf(buf, sizeof(buf), "Ndk[%s(%s()):%d]", file, func, line); 52 | __android_log_vprint(prio, buf, fmt, args); 53 | va_end(args); 54 | } 55 | 56 | #if(DEBUG <= LOG_VERBOSE) 57 | #define LOGV(tag,...) android_log_print(ANDROID_LOG_VERBOSE,tag,##__VA_ARGS__) 58 | #define LOGVA(...) LOGV(TAG,##__VA_ARGS__) 59 | #else 60 | #define LOGV(tag,...) 61 | #define LOGVA(...) 62 | #endif 63 | 64 | #if(DEBUG <= LOG_DEBUG) 65 | #define LOGD(tag,...) android_log_print(ANDROID_LOG_DEBUG,tag,##__VA_ARGS__) 66 | #define LOGDA(...) LOGD(TAG,##__VA_ARGS__) 67 | #else 68 | #define LOGD(tag,...) 69 | #define LOGDA(...) 70 | #endif 71 | 72 | #if(DEBUG <= LOG_INFO) 73 | #define LOGI(tag,...) android_log_print(ANDROID_LOG_INFO,tag,##__VA_ARGS__) 74 | #define LOGIA(...) LOGI(TAG,##__VA_ARGS__) 75 | #else 76 | #define LOGI(tag,...) 77 | #define LOGIA(...) 78 | #endif 79 | 80 | #if(DEBUG <= LOG_WARN) 81 | #define LOGW(tag,...) android_log_print(ANDROID_LOG_WARN,tag,##__VA_ARGS__) 82 | #define LOGWA(...) LOGW(TAG,##__VA_ARGS__) 83 | #else 84 | #define LOGW(tag,...) 85 | #define LOGWA(...) 86 | #endif 87 | 88 | #if(DEBUG <= LOG_ERROR) 89 | #define LOGE(tag,...) android_log_print(ANDROID_LOG_ERROR,tag,##__VA_ARGS__) 90 | #define LOGEA(...) LOGE(TAG, ##__VA_ARGS__) 91 | #else 92 | #define LOGE(tag,...) 93 | #define LOGEA(...) 94 | #endif 95 | 96 | #if(DEBUG <= LOG_FATAL) 97 | #define LOGF(tag,...) android_log_print(ANDROID_LOG_FATAL,tag,##__VA_ARGS__) 98 | #define LOGFA(...) LOGF(TAG,##__VA_ARGS__) 99 | #else 100 | #define LOGF(tag,...) 101 | #define LOGFA(...) 102 | #endif 103 | 104 | __END_DECLS 105 | 106 | #endif /* LOG_H_ */ 107 | 108 | -------------------------------------------------------------------------------- /project/Test/ApiTest/lib/dalviksystem.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/Test/ApiTest/lib/dalviksystem.jar -------------------------------------------------------------------------------- /project/Test/ApiTest/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project/Test/ApiTest/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-21 15 | android.library.reference.1=../DroidPlugin 16 | manifestmerger.enabled=true 17 | -------------------------------------------------------------------------------- /project/Test/ApiTest/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/Test/ApiTest/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/Test/ApiTest/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/Test/ApiTest/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /project/Test/ApiTest/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/Test/ApiTest/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/Test/ApiTest/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/Test/ApiTest/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /project/Test/ApiTest/res/layout/activity_activity_test.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 |