├── .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 |
14 |
15 |
20 |
25 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/layout/activity_native_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/layout/activity_web_view_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/layout/broadcast_receiver.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
17 |
22 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/layout/content_provider.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
18 |
23 |
28 |
33 |
34 |
35 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
37 |
38 |
43 |
44 |
49 |
50 |
55 |
56 |
61 |
62 |
67 |
68 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/layout/notification_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
17 |
22 |
27 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/layout/service.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
18 |
23 |
28 |
33 |
38 |
43 |
44 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ApiTest
4 | StandardActivity
5 |
6 | Hello world!
7 | Settings
8 | SingleTopActivity
9 | SingleTopActivity1
10 | SingleTopActivity2
11 | SingleTopActivity3
12 | SingleTopActivity4
13 | SingleTopActivity5
14 | SingleTaskActivity
15 | SingleTaskActivity1
16 | SingleTaskActivity2
17 | SingleTaskActivity3
18 | SingleTaskActivity4
19 | SingleTaskActivity5
20 | SingleInstanceActivity
21 | SingleInstanceActivity1
22 | SingleInstanceActivity2
23 | SingleInstanceActivity3
24 | SingleInstanceActivity4
25 | SingleInstanceActivity5
26 | ActivityTestActivity
27 | NativeTestActivity
28 | WebViewTestActivity
29 |
30 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/ActivityTestActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.util.Log;
7 | import android.view.View;
8 |
9 |
10 | public class ActivityTestActivity extends AppCompatActivity implements View.OnClickListener {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_activity_test);
16 | findViewById(R.id.button1).setOnClickListener(this);
17 | findViewById(R.id.button2).setOnClickListener(this);
18 | findViewById(R.id.button3).setOnClickListener(this);
19 | findViewById(R.id.button4).setOnClickListener(this);
20 | }
21 |
22 | @Override
23 | public void onClick(View v) {
24 | int id = v.getId();
25 | if (id == R.id.button1) {
26 | startActivityForResult(new Intent(this, StandardActivity.class), 1986);
27 | } else if (id == R.id.button2) {
28 | startActivity(new Intent(this, SingleTopActivity.class));
29 | } else if (id == R.id.button3) {
30 | startActivity(new Intent(this, SingleTaskActivity.class));
31 | } else if (id == R.id.button4) {
32 | startActivity(new Intent(this, SingleInstanceActivity.class));
33 | }
34 | }
35 |
36 | @Override
37 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
38 | super.onActivityResult(requestCode, resultCode, data);
39 | Log.e("ActivityTestActivity", String.format("onActivityResult,requestCode=%s,resultCode=%s", requestCode, resultCode));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/BaseService.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.IBinder;
6 | import android.util.Log;
7 | import android.widget.Toast;
8 |
9 | /**
10 | * Created by zhangyong6 on 2015/3/11.
11 | */
12 | public abstract class BaseService extends Service {
13 | protected String tag = "haha";
14 |
15 | abstract String getTag();
16 |
17 | @Override
18 | public IBinder onBind(Intent intent) {
19 | String msg = String.format(">>服务%s:onBind,intent=%s", tag, intent);
20 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
21 | Log.e(tag, msg);
22 | return null;
23 | }
24 |
25 | @Override
26 | public boolean onUnbind(Intent intent) {
27 | String msg = String.format(">>服务%s:onUnbind,intent=%s", tag, intent);
28 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
29 | Log.e(tag, msg);
30 | return super.onUnbind(intent);
31 | }
32 |
33 | @Override
34 | public void onCreate() {
35 | super.onCreate();
36 | String msg = String.format(">>服务%s:onCreate", tag);
37 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
38 | Log.e(tag, msg);
39 | }
40 |
41 | @Override
42 | public void onStart(Intent intent, int startId) {
43 | super.onStart(intent, startId);
44 | String msg = String.format(">>服务%s:onStart,intent=%s,startId=%s", tag, intent, startId);
45 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
46 | Log.e(tag, msg);
47 | }
48 |
49 | @Override
50 | public int onStartCommand(Intent intent, int flags, int startId) {
51 | String msg = String.format(">>服务%s:onStartCommand,intent=%s,flags=%s,startId=%s", tag, intent, flags, startId);
52 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
53 | Log.e(tag, msg);
54 | return super.onStartCommand(intent, flags, startId);
55 | }
56 |
57 | @Override
58 | public void onDestroy() {
59 | String msg = String.format(">>服务%s:onDestroy", tag);
60 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
61 | Log.e(tag, msg);
62 | super.onDestroy();
63 | }
64 |
65 | @Override
66 | public void onRebind(Intent intent) {
67 | String msg = String.format(">>服务%s:onRebind,intent=%s", tag, intent);
68 | Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
69 | Log.e(tag, msg);
70 | super.onRebind(intent);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/Binder1.aidl:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | /**
4 | * Created by zhangyong6 on 2016/1/25.
5 | */
6 | interface Binder1 {
7 |
8 | int ping(in int inValue);
9 |
10 | String pingStr(in String inValue);
11 | }
12 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/Binder2.aidl:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | /**
4 | * Created by zhangyong6 on 2016/1/25.
5 | */
6 | interface Binder2 {
7 |
8 | int ping(in int inValue);
9 |
10 | String pingStr(in String inValue);
11 | }
12 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/BroadcastReceiverTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.IntentFilter;
7 | import android.os.Bundle;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.util.Log;
10 | import android.view.View;
11 | import android.view.View.OnClickListener;
12 | import android.widget.Toast;
13 |
14 | /**
15 | * Created by zhangyong6 on 2015/3/2.
16 | */
17 | public class BroadcastReceiverTest extends AppCompatActivity implements OnClickListener {
18 | @Override
19 | public void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.broadcast_receiver);
22 | findViewById(R.id.button1).setOnClickListener(this);
23 | findViewById(R.id.button2).setOnClickListener(this);
24 | findViewById(R.id.button3).setOnClickListener(this);
25 | findViewById(R.id.button4).setOnClickListener(this);
26 | }
27 |
28 | private static class MyBroadcastReceiver extends BroadcastReceiver {
29 | public static final String ACTION = "com.example.ApiTest.MyBroadcastReceiver";
30 | private static final String TAG = "MyBroadcastReceiver";
31 |
32 | public static void send(Context c) {
33 | Intent intent = new Intent(ACTION);
34 | c.sendBroadcast(intent);
35 | }
36 |
37 | public static void reg(Context c, MyBroadcastReceiver re) {
38 | IntentFilter filter = new IntentFilter();
39 | filter.addAction(ACTION);
40 | c.registerReceiver(re, filter);
41 | }
42 |
43 | public static void unreg(Context c, MyBroadcastReceiver re) {
44 | c.unregisterReceiver(re);
45 | }
46 |
47 | @Override
48 | public void onReceive(Context context, Intent intent) {
49 | String msg = String.format(">>>>%s onReceive:context=%s,intent=%s", TAG, context, intent);
50 | Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
51 | Log.e(TAG, msg);
52 | }
53 | }
54 |
55 | private MyBroadcastReceiver re = new MyBroadcastReceiver();
56 |
57 | @Override
58 | public void onClick(View v) {
59 | int id = v.getId();
60 | if (id == R.id.button1) {
61 | MyBroadcastReceiver.reg(this, re);
62 | } else if (id == R.id.button2) {
63 | MyBroadcastReceiver.unreg(this, re);
64 | } else if (id == R.id.button3) {
65 | MyBroadcastReceiver.send(this);
66 | } else if (id == R.id.button4) {
67 | StaticBroadcastReceiver.send(this);
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/ContentProviderTest2.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.net.Uri;
4 | import android.os.Bundle;
5 |
6 | /**
7 | * Created by zhangyong6 on 2015/3/11.
8 | */
9 | public class ContentProviderTest2 extends ContentProviderTest {
10 | @Override
11 | public void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | TAG = "ContentProviderTest2";
14 | }
15 |
16 | protected Uri getsUri() {
17 | return MyContentProvider2.sUri;
18 | }
19 | }
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/MyContentProvider1.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.ContentProvider;
4 | import android.content.ContentValues;
5 | import android.database.Cursor;
6 | import android.database.MatrixCursor;
7 | import android.net.Uri;
8 | import android.os.Handler;
9 | import android.os.Looper;
10 | import android.util.Log;
11 | import android.widget.Toast;
12 |
13 | import java.util.Arrays;
14 |
15 | /**
16 | * Created by zhangyong6 on 2015/3/3.
17 | */
18 | public class MyContentProvider1 extends ContentProvider {
19 |
20 | public static final String name = "com.example.ApiTest.MyContentProvider1";
21 | public static final Uri sUri = Uri.parse("content://" + name);
22 | private static final String TAG = MyContentProvider1.class.getSimpleName();
23 |
24 | @Override
25 | public boolean onCreate() {
26 | String msg = String.format(">>>>%s onCreate", TAG);
27 |
28 | showMsg(msg);
29 | return true;
30 | }
31 |
32 | @Override
33 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
34 | String msg = String.format(">>>>%s query:uri=%s, projection=%s, selection=%s,selectionArgs=%s, sortOrder=%s", TAG, uri, projection, selection, Arrays.toString(selectionArgs), sortOrder);
35 | showMsg(msg);
36 | MatrixCursor c = new MatrixCursor(new String[]{"name", "sex"});
37 | c.addRow(new String[]{"张三", "男"});
38 | c.addRow(new String[]{"李四", "女"});
39 | c.addRow(new String[]{"王武", "不男不女"});
40 | return c;
41 | }
42 |
43 | private void showMsg(final String msg) {
44 | Handler handler = new Handler(Looper.getMainLooper());
45 | handler.post(new Runnable() {
46 | @Override
47 | public void run() {
48 | Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
49 | }
50 | });
51 | Log.e(TAG, msg);
52 | }
53 |
54 | @Override
55 | public String getType(Uri uri) {
56 | String msg = String.format(">>>>%s getType:uri=%s", TAG, uri);
57 | showMsg(msg);
58 | return "text/x-zhangyong";
59 | }
60 |
61 | @Override
62 | public Uri insert(Uri uri, ContentValues values) {
63 | String msg = String.format(">>>>%s insert:uri=%s, values=%s", TAG, uri, values);
64 | showMsg(msg);
65 | return Uri.parse("content://" + name + "/12");
66 | }
67 |
68 | @Override
69 | public int delete(Uri uri, String selection, String[] selectionArgs) {
70 | String msg = String.format(">>>>%s delete:uri=%s, selection=%s, selectionArgs=%s", TAG, uri, selection, Arrays.toString(selectionArgs));
71 | showMsg(msg);
72 | return 66;
73 | }
74 |
75 | @Override
76 | public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
77 | String msg = String.format(">>>>%s update:uri=%s, values=%s, selection=%s, selectionArgs=%s", TAG, uri, values, selection, Arrays.toString(selectionArgs));
78 | showMsg(msg);
79 | return 77;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/MyContentProvider2.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.ContentProvider;
4 | import android.content.ContentValues;
5 | import android.database.Cursor;
6 | import android.database.MatrixCursor;
7 | import android.net.Uri;
8 | import android.os.Handler;
9 | import android.os.Looper;
10 | import android.util.Log;
11 | import android.widget.Toast;
12 |
13 | import java.util.Arrays;
14 |
15 | /**
16 | * Created by zhangyong6 on 2015/3/3.
17 | */
18 | public class MyContentProvider2 extends ContentProvider {
19 |
20 | public static final String name = "com.example.ApiTest.MyContentProvider2";
21 | public static final Uri sUri = Uri.parse("content://" + name);
22 | private static final String TAG = MyContentProvider2.class.getSimpleName();
23 |
24 | @Override
25 | public boolean onCreate() {
26 | String msg = String.format(">>>>%s onCreate", TAG);
27 | showMsg(msg);
28 | return true;
29 | }
30 |
31 | @Override
32 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
33 | String msg = String.format(">>>>%s query:uri=%s, projection=%s, selection=%s,selectionArgs=%s, sortOrder=%s", TAG, uri, projection, selection, Arrays.toString(selectionArgs), sortOrder);
34 | showMsg(msg);
35 | MatrixCursor c = new MatrixCursor(new String[]{"name", "sex"});
36 | c.addRow(new String[]{"张三", "男"});
37 | c.addRow(new String[]{"李四", "女"});
38 | c.addRow(new String[]{"王武", "不男不女"});
39 | return c;
40 | }
41 |
42 | private void showMsg(final String msg) {
43 | Handler handler = new Handler(Looper.getMainLooper());
44 | handler.post(new Runnable() {
45 | @Override
46 | public void run() {
47 | Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
48 | }
49 | });
50 | Log.e(TAG, msg);
51 | }
52 |
53 | @Override
54 | public String getType(Uri uri) {
55 | String msg = String.format(">>>>%s getType:uri=%s", TAG, uri);
56 | showMsg(msg);
57 | return "text/x-zhangyong";
58 | }
59 |
60 | @Override
61 | public Uri insert(Uri uri, ContentValues values) {
62 | String msg = String.format(">>>>%s insert:uri=%s, values=%s", TAG, uri, values);
63 | showMsg(msg);
64 | return Uri.parse("content://" + name + "/12");
65 | }
66 |
67 | @Override
68 | public int delete(Uri uri, String selection, String[] selectionArgs) {
69 | String msg = String.format(">>>>%s delete:uri=%s, selection=%s, selectionArgs=%s", TAG, uri, selection, Arrays.toString(selectionArgs));
70 | showMsg(msg);
71 | return 66;
72 | }
73 |
74 | @Override
75 | public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
76 | String msg = String.format(">>>>%s update:uri=%s, values=%s, selection=%s, selectionArgs=%s", TAG, uri, values, selection, Arrays.toString(selectionArgs));
77 | showMsg(msg);
78 | return 77;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/NativeTestActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.util.Log;
6 |
7 | import com.morgoo.nativec.NativeCHelper;
8 |
9 | public class NativeTestActivity extends AppCompatActivity {
10 |
11 | private static final String TAG = NativeTestActivity.class.getSimpleName();
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_native_test);
17 | Log.e(TAG, " NativeCHelper.ping()=" + NativeCHelper.ping());
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/Service1.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.Intent;
4 | import android.os.Handler;
5 | import android.os.IBinder;
6 | import android.os.Looper;
7 | import android.os.RemoteException;
8 | import android.util.Log;
9 | import android.widget.Toast;
10 |
11 |
12 | /**
13 | * Created by zhangyong6 on 2015/3/2.
14 | */
15 | public class Service1 extends BaseService {
16 |
17 | @Override
18 | String getTag() {
19 | return Service1.class.getSimpleName();
20 | }
21 |
22 | public Service1() {
23 | tag = getTag();
24 | }
25 |
26 | @Override
27 | public IBinder onBind(final Intent intent) {
28 | super.onBind(intent);
29 | Binder1.Stub stub = new Binder1.Stub() {
30 |
31 | private Handler handler = new Handler(Looper.getMainLooper());
32 |
33 | @Override
34 | public int ping(int inValue) throws RemoteException {
35 |
36 | int i = inValue + 10;
37 |
38 | final String msg = String.format(">>服务%s:onBind,intent=%s ping=%s,value=%s", tag, intent, inValue, i);
39 | handler.post(new Runnable() {
40 | @Override
41 | public void run() {
42 | Toast.makeText(Service1.this, msg, Toast.LENGTH_SHORT).show();
43 | }
44 | });
45 | Log.e(tag, msg);
46 |
47 | return i;
48 | }
49 |
50 | @Override
51 | public String pingStr(String inValue) throws RemoteException {
52 | String i = inValue + ",Yes";
53 |
54 | final String msg = String.format(">>服务%s:onBind,intent=%s ping=%s,value=%s", tag, intent, inValue, i);
55 | handler.post(new Runnable() {
56 | @Override
57 | public void run() {
58 | Toast.makeText(Service1.this, msg, Toast.LENGTH_SHORT).show();
59 | }
60 | });
61 | Log.e(tag, msg);
62 |
63 | return i;
64 | }
65 | };
66 | return stub;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/Service2.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.Intent;
4 | import android.os.Handler;
5 | import android.os.IBinder;
6 | import android.os.Looper;
7 | import android.os.RemoteException;
8 | import android.util.Log;
9 | import android.widget.Toast;
10 |
11 | /**
12 | * Created by zhangyong6 on 2015/3/2.
13 | */
14 | public class Service2 extends BaseService {
15 |
16 | @Override
17 | String getTag() {
18 | return Service2.class.getSimpleName();
19 | }
20 |
21 | public Service2() {
22 | tag = getTag();
23 | }
24 |
25 |
26 | @Override
27 | public IBinder onBind(final Intent intent) {
28 | super.onBind(intent);
29 | return new Binder2.Stub() {
30 |
31 | private Handler handler = new Handler(Looper.getMainLooper());
32 |
33 | @Override
34 | public int ping(int inValue) throws RemoteException {
35 |
36 | int i = inValue + 15;
37 |
38 | final String msg = String.format(">>服务%s:onBind,intent=%s ping=%s,value=%s", tag, intent, inValue, i);
39 | handler.post(new Runnable() {
40 | @Override
41 | public void run() {
42 | Toast.makeText(Service2.this, msg, Toast.LENGTH_SHORT).show();
43 | }
44 | });
45 | Log.e(tag, msg);
46 |
47 | return i;
48 | }
49 |
50 | @Override
51 | public String pingStr(String inValue) throws RemoteException {
52 | String i = inValue + ",Yes,very much!";
53 |
54 | final String msg = String.format(">>服务%s:onBind,intent=%s ping=%s,value=%s", tag, intent, inValue, i);
55 | handler.post(new Runnable() {
56 | @Override
57 | public void run() {
58 | Toast.makeText(Service2.this, msg, Toast.LENGTH_SHORT).show();
59 | }
60 | });
61 | Log.e(tag, msg);
62 |
63 | return i;
64 | }
65 | };
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/Service3.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | /**
4 | * Created by zhangyong6 on 2015/3/2.
5 | */
6 | public class Service3 extends Service1 {
7 |
8 | @Override
9 | String getTag() {
10 | return Service3.class.getSimpleName();
11 | }
12 |
13 | public Service3() {
14 | tag = getTag();
15 | }
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/Service4.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | /**
4 | * Created by zhangyong6 on 2015/3/2.
5 | */
6 | public class Service4 extends Service2 {
7 |
8 | @Override
9 | String getTag() {
10 | return Service4.class.getSimpleName();
11 | }
12 |
13 | public Service4() {
14 | tag = getTag();
15 | }
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/ServiceTest2.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 |
6 | /**
7 | * Created by zhangyong6 on 2015/3/11.
8 | */
9 | public class ServiceTest2 extends ServiceTest1 {
10 | @Override
11 | public void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | service1 = new Intent(this, Service3.class);
14 | service2 = new Intent(this, Service4.class);
15 | }
16 | }
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/SingleInstanceActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | public class SingleInstanceActivity extends LaunchModeTestActivity {
4 |
5 | public static class SingleInstanceActivity1 extends SingleInstanceActivity {
6 | }
7 |
8 | public static class SingleInstanceActivity2 extends SingleInstanceActivity {
9 | }
10 |
11 | public static class SingleInstanceActivity3 extends SingleInstanceActivity {
12 | }
13 |
14 | public static class SingleInstanceActivity4 extends SingleInstanceActivity {
15 | }
16 |
17 | public static class SingleInstanceActivity5 extends SingleInstanceActivity {
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/SingleTaskActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | public class SingleTaskActivity extends LaunchModeTestActivity{
4 |
5 | public static class SingleTaskActivity1 extends SingleTaskActivity{}
6 | public static class SingleTaskActivity2 extends SingleTaskActivity{}
7 | public static class SingleTaskActivity3 extends SingleTaskActivity{}
8 | public static class SingleTaskActivity4 extends SingleTaskActivity{}
9 | public static class SingleTaskActivity5 extends SingleTaskActivity{}
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/SingleTopActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | public class SingleTopActivity extends LaunchModeTestActivity {
4 |
5 | public static class SingleTopActivity1 extends SingleTopActivity{}
6 |
7 | public static class SingleTopActivity2 extends SingleTopActivity{}
8 |
9 | public static class SingleTopActivity3 extends SingleTopActivity{}
10 |
11 | public static class SingleTopActivity4 extends SingleTopActivity{}
12 |
13 | public static class SingleTopActivity5 extends SingleTopActivity{}
14 |
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/StandardActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | public class StandardActivity extends LaunchModeTestActivity {
4 |
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/StaticBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.util.Log;
7 | import android.widget.Toast;
8 |
9 | /**
10 | * Created by zhangyong6 on 2015/3/3.
11 | */
12 | public class StaticBroadcastReceiver extends BroadcastReceiver {
13 |
14 | public static final String ACTION = "com.example.ApiTest.StaticBroadcastReceiver";
15 | private static final String TAG = "StaticBroadcastReceiver";
16 |
17 | public static void send(Context c) {
18 | Intent intent = new Intent(ACTION);
19 | c.sendBroadcast(intent);
20 | }
21 |
22 | @Override
23 | public void onReceive(Context context, Intent intent) {
24 | String msg = String.format(">>>>%s onReceive:context=%s,intent=%s", TAG, context, intent);
25 | Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
26 | Log.e(TAG, msg);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/example/ApiTest/WebViewTestActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ApiTest;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.webkit.WebView;
6 | import android.webkit.WebViewClient;
7 |
8 | public class WebViewTestActivity extends AppCompatActivity {
9 |
10 | private WebView mWebView;
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_web_view_test);
16 | mWebView = (WebView) findViewById(R.id.webview);
17 | mWebView.getSettings().setJavaScriptEnabled(true);
18 | mWebView.setWebViewClient(new WebViewClient() {
19 | @Override
20 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
21 | return true;
22 | }
23 | });
24 | mWebView.loadUrl("http://www.baidu.com");
25 |
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/project/Test/ApiTest/src/com/morgoo/nativec/NativeCHelper.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 |
5 | package com.morgoo.nativec;
6 |
7 | /**
8 | * @author zhangyong232@gmail.com
9 | */
10 | public class NativeCHelper {
11 |
12 | private static boolean sSoLoaded = false;
13 | private static Throwable sThrowable;
14 |
15 | static {
16 | tryLoadLibraryByName("Test");
17 | }
18 |
19 | public static void tryLoadLibraryByName(String name) {
20 | try {
21 | System.loadLibrary(name);
22 | sSoLoaded = true;
23 | } catch (Throwable e) {
24 | sThrowable = e;
25 | sSoLoaded = false;
26 | }
27 | }
28 |
29 | public static void tryLoadLibraryByPath(String pathName) {
30 | try {
31 | System.load(pathName);
32 | sSoLoaded = true;
33 | } catch (Throwable e) {
34 | sThrowable = e;
35 | sSoLoaded = false;
36 | }
37 | }
38 |
39 | public static boolean isSoLoaded() {
40 | return sSoLoaded;
41 | }
42 |
43 | // ************************ Helper Start *******************************//
44 | private final native static int nativePing();
45 |
46 | public final static int ping() {
47 | if (sSoLoaded) {
48 | return nativePing();
49 | } else {
50 | if (sThrowable != null) {
51 | String msg = sThrowable.getMessage();
52 | UnsatisfiedLinkError error = new UnsatisfiedLinkError(
53 | msg != null ? msg : "Can not lazy init zhook");
54 | error.initCause(sThrowable);
55 | throw error;
56 | } else {
57 | throw new UnsatisfiedLinkError(
58 | "We can not load so,please see logcat");
59 | }
60 | }
61 | }
62 | // ************************ Helper End *******************************//
63 | }
64 |
--------------------------------------------------------------------------------
/project/TestPlugin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
9 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/project/TestPlugin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | dependencies {
4 | compile "com.android.support:support-v4:23.1.1"
5 | compile "com.android.support:gridlayout-v7:23.1.1"
6 | compile "com.android.support:cardview-v7:23.1.1"
7 | compile 'com.android.support:appcompat-v7:23.1.1'
8 | compile 'com.android.support:design:23.1.1'
9 |
10 | compile fileTree(dir: 'libs', include: '*.jar')
11 | compile project(':Libraries:DroidPlugin')
12 | }
13 |
14 |
15 | android {
16 | signingConfigs {
17 | MySignConfig {
18 | storeFile file(readProperty("key.store", "key.store"))
19 | keyAlias readProperty("key.alias", "key.alias")
20 | keyPassword readProperty("key.alias.password", "key.alias.password")
21 | storePassword readProperty("key.store.password", "key.store.password")
22 | }
23 | }
24 |
25 | compileSdkVersion rootProject.ext.compileSdkVersion
26 | buildToolsVersion rootProject.ext.buildToolsVersion
27 |
28 | sourceSets {
29 | main {
30 | manifest.srcFile 'AndroidManifest.xml'
31 | java.srcDirs = ['src']
32 | resources.srcDirs = ['src']
33 | aidl.srcDirs = ['src']
34 | renderscript.srcDirs = ['src']
35 | res.srcDirs = ['res']
36 | assets.srcDirs = ['assets']
37 | }
38 |
39 | instrumentTest.setRoot('tests')
40 | debug.setRoot('build-types/debug')
41 | release.setRoot('build-types/release')
42 | }
43 | lintOptions {
44 | abortOnError false
45 | }
46 |
47 | buildTypes {
48 | release {
49 | proguardFiles getDefaultProguardFile('proguard-android.txt'), "proguard-project.txt"
50 | signingConfig signingConfigs.MySignConfig
51 | }
52 | }
53 | }
54 |
55 | //
56 | def readProperty(key, defaultValue) {
57 | def value = System.getenv(key)
58 | if (value != null && value.length() > 0) {
59 | return value
60 | }
61 |
62 | if (project.hasProperty(key)) {
63 | return project.property(key)
64 | }
65 | return defaultValue
66 | }
67 |
--------------------------------------------------------------------------------
/project/TestPlugin/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 | -libraryjars lib/layoutlib.jar
23 |
24 | -keepclasseswithmembers public class * {
25 | public static void main(java.lang.String[]);
26 | }
27 |
28 | -keepclasseswithmembers public class com.morgoo.hook.NativeHelper {
29 | *** nativeHandleHookedMethod(...);
30 | *** nativeHa(...);
31 | *** nativeHb(...);
32 | *** nativeHc(...);
33 | *** nativeHd(...);
34 | *** nativeHe(...);
35 | }
36 |
--------------------------------------------------------------------------------
/project/TestPlugin/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/TestPlugin/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/TestPlugin/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/TestPlugin/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/TestPlugin/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/TestPlugin/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/TestPlugin/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/TestPlugin/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Qihoo360/DroidPlugin/05cb9ccd0d2c7257c9a91036f7d985b96e51302a/project/TestPlugin/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/TestPlugin/res/layout/apk_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
25 |
26 |
33 |
34 |
42 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/project/TestPlugin/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/project/TestPlugin/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/project/TestPlugin/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/project/TestPlugin/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 插件
4 |
5 |
--------------------------------------------------------------------------------
/project/TestPlugin/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/project/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:1.5.0'
8 | }
9 | }
10 |
11 | ext {
12 | compileSdkVersion = 23
13 | buildToolsVersion = "23.0.1"
14 | }
15 |
16 | allprojects.each { p ->
17 | p.buildDir "bin"
18 | }
19 |
20 | task clean(type: Delete) {
21 | delete rootProject.buildDir
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/project/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Wed Mar 09 17:35:33 CST 2016
16 | android.useDeprecatedNdk=true
17 |
--------------------------------------------------------------------------------
/project/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/project/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':Libraries:DroidPlugin'
2 | include ':TestPlugin'
3 | include ':Test:ApiTest'
4 | rootProject.name = 'DroidPlugin'
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ### 360DroidPlugin 产品介绍
2 |
3 | #### 官方网站
4 | [https://droidplugin.360.cn/](https://droidplugin.360.cn/)
5 |
6 | #### 产品概述
7 | 360DroidPlugin 是基于 360 核心安卓沙箱引擎技术,支持安卓应用程序在沙箱虚拟引擎内部运行的“轻量级安卓虚拟机”。对于引擎内部运行的应用,360DroidPlugin 有着极高的权限。所有应用的运行、安装、卸载、消息处理、文件存储等操作都可以通过 360DroidPlugin 统一管理。
8 |
9 | #### 产品优势
10 | - **适配性好**:适配市面主流厂商操作系统及安卓版本。
11 | - **功能强大**:便于企业利用此技术,对自身业务进行提效和创新。
12 | - **应用广泛**:分身多开、游戏盒子、游戏手柄、隐私安全、政企安全、视频美颜等业务领域。
13 | - **优点显著**:运行稳定、兼容性好、Hook 能力强、扩展功能丰富。
14 |
15 | #### 主要功能
16 | 1. **双开/多开需求**
17 | - 支持在同一部手机上安装多个微信/QQ/WhatsApp/Facebook 等应用,实现一部手机,多个账号同时登录。
18 |
19 | 2. **移动安全需求**
20 | - 提供内部与外部的隔离机制,包括文件隔离、组件隔离、进程通讯隔离,实现工作事务与个人事务的安全隔离。
21 |
22 | **具体功能**
23 | - **应用行为审计**:实时监测用户使用行为,违规信息上传服务器,实现时间围栏、地理围栏、敏感关键字过滤拦截等功能。
24 | - **数据加密**:对应用的全部数据/文件加密,保证数据/文件安全。
25 | - **数据采集**:实现应用数据的实时无感上传需求,如聊天记录、转账记录等,防止事后删除无法追溯。
26 | - **数据防泄漏**:实现应用防复制/粘贴、防截屏/录屏、防分享/转发、水印溯源等需求。
27 | - **防攻击泄密**:控制 APP 获取短信/通讯录/通话记录/后台录音/后台拍照/浏览历史/位置信息等隐私行为,防止木马/恶意 APP 获取用户隐私数据。
28 |
29 | 3. **免 ROOT HOOK 需求**
30 | - 提供 Java 和 Native 的 Hook 能力,实现 APP 监控管理、移动安全等功能需求。
31 |
32 | 4. **APP 静默安装需求**
33 | - 提供 APP 静默安装、静默升级、静默卸载能力,实现应用商店或游戏中心下载后立即安装,提升用户体验。
34 |
35 | 5. **APP 管控需求**
36 | - 掌握 APP 访问系统 API、敏感数据、设备信息等情况(如APP是否访问了联系人,相册,通话记录,是否访问了用户的地理位置等信息),并控制或构造自定义信息。获取 APP 私有数据,如聊天数据库等,实现对 APP 行为的全面控制。
37 |
38 | 6. **其他需求**
39 | - 对于内部的 APP 具有完全的监管和控制能力,几乎能满足一切需求。
40 |
41 | #### 版本更新(2024年3月上旬)
42 | - 适配安卓 14 高版本
43 | - 解决鸿蒙 4.0 版本微信适配问题
44 | - 解决部分应用检测运行环境问题
45 | - 支持抖音小程序
46 | - 解决 Unity 32 位游戏运行问题
47 | - 提升相册读取速度
48 | - 增加外部应用是否可见能力
49 | - 增加文件和包名分身相互覆盖安装能力
50 | - 增加传输扩展数据
51 | - 增加跨应用登录 API
52 | - 支持沙箱内应用安装第三方应用
53 | - 适配画中画功能
54 | - 支持多款加固方案
55 |
56 | #### 游戏能力升级(2024年)
57 | - **统一登录/实名制**:平台一键授权游戏登录/实名信息。
58 | - **游戏变速**:卡牌/回合制游戏加速,任务轻松高效完成。
59 | - **游戏双开**:助力小号养成,多账号随时切换。
60 | - **悬浮窗**:提供游戏变速、截屏录屏、游戏社区等内容。
61 | - **游戏时长统计**:提供用户专属数据,打造成就系统。
62 | - **游戏引擎升级**:支持谷歌、网易等游戏适配。
63 | - **GMS**:支持谷歌套件,实现登录支付等能力。
64 | - **广告 SDK**:定制化广告 SDK 高效快速变现。
65 |
66 | #### 官方网站
67 | [https://droidplugin.360.cn/](https://droidplugin.360.cn/)
68 |
--------------------------------------------------------------------------------