├── DroidService
├── .gitignore
├── Libraries
│ └── droidservices
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── morgoo
│ │ │ └── droidservices
│ │ │ └── ApplicationTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── aidl
│ │ │ └── com
│ │ │ │ └── morgoo
│ │ │ │ └── droidservices
│ │ │ │ └── IServiceManager.aidl
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── morgoo
│ │ │ │ └── droidservices
│ │ │ │ ├── CompatUtils.java
│ │ │ │ ├── ContentProviderBinderTransact.java
│ │ │ │ ├── IServiceManagerImpl.java
│ │ │ │ ├── ServiceItem.java
│ │ │ │ └── ServiceManager.java
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── morgoo
│ │ └── droidservices
│ │ └── ExampleUnitTest.java
├── app
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── morgoo
│ │ │ └── droidservicetest
│ │ │ └── ApplicationTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── morgoo
│ │ │ │ └── droidservicetest
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainActivityFragment.java
│ │ └── res
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── content_main.xml
│ │ │ └── fragment_main.xml
│ │ │ ├── menu
│ │ │ └── menu_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ └── styles.xml
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── morgoo
│ │ └── droidservicetest
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── LICENSE
└── readme.md
/DroidService/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /bin
8 | /captures
9 | /gradle
10 | /Libraries/droidservices/bin
11 | /app/bin
12 |
13 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 10
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | }
24 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Program_Files\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/androidTest/java/com/morgoo/droidservices/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservices;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/aidl/com/morgoo/droidservices/IServiceManager.aidl:
--------------------------------------------------------------------------------
1 | // IServiceManager.aidl
2 | package com.morgoo.droidservices;
3 |
4 | import android.os.IBinder;
5 | import android.content.Intent;
6 |
7 | interface IServiceManager {
8 |
9 | void addService(in String callingPackageName, in String name, in IBinder binder);
10 |
11 | void addIntentService(in String callingPackageName, in String name, in Intent intent);
12 |
13 | IBinder getService(in String callingPackageName, in String name);
14 |
15 | void removeService(in String callingPackageName, in String name);
16 | }
17 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/java/com/morgoo/droidservices/CompatUtils.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservices;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.ContentResolver;
5 | import android.net.Uri;
6 | import android.os.Build;
7 | import android.os.Bundle;
8 | import android.os.IBinder;
9 | import android.util.Log;
10 |
11 | import java.lang.reflect.Method;
12 |
13 | /**
14 | * Created by zhangyong232@gmail.com on 2016/3/9.
15 | */
16 | class CompatUtils {
17 |
18 | static class ContentResolverCompat {
19 |
20 | public static Bundle call(ContentResolver resolver, Uri uri, String method,
21 | String arg, Bundle extras) {
22 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
23 | return callAPI11(resolver, uri, method, arg, extras);
24 | } else {
25 | return callAPI10(resolver, uri, method, arg, extras);
26 | }
27 | }
28 |
29 | private static Bundle callAPI10(ContentResolver resolver, Uri uri, String method, String arg, Bundle extras) {
30 | try {
31 | Method call = null;
32 | try {
33 | call = ContentResolver.class.getDeclaredMethod("call", Uri.class, String.class, String.class, Bundle.class);
34 | } catch (NoSuchMethodException e) {
35 | }
36 | if (call == null) {
37 | call = ContentResolver.class.getDeclaredMethod("call", Uri.class, String.class, String.class, Bundle.class);
38 | }
39 | return (Bundle) call.invoke(resolver, uri, method, arg, extras);
40 | } catch (Exception e) {
41 | RuntimeException exception = new RuntimeException(e);
42 | exception.initCause(e);
43 | throw exception;
44 | }
45 | }
46 |
47 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
48 | private static Bundle callAPI11(ContentResolver resolver, Uri uri, String method, String arg, Bundle extras) {
49 | return resolver.call(uri, method, arg, extras);
50 | }
51 | }
52 |
53 | static class BundleCompat {
54 |
55 | private static final String TAG = "Bundle";
56 |
57 | public static IBinder getBinder(Bundle data, String key) {
58 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
59 | return getBinerAPI18(data, key);
60 | } else {
61 | return getBinerAPI10(data, key);
62 | }
63 | }
64 |
65 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
66 | private static IBinder getBinerAPI18(Bundle data, String key) {
67 | return data.getBinder(key);
68 | }
69 |
70 | private static IBinder getBinerAPI10(Bundle data, String key) {
71 | Object o = data.get(key);
72 | if (o == null) {
73 | return null;
74 | }
75 | try {
76 | return (IBinder) o;
77 | } catch (ClassCastException e) {
78 | typeWarning(key, o, "IBinder", e);
79 | return null;
80 | }
81 | }
82 |
83 | public static void putBinder(Bundle data, String key, IBinder value) {
84 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
85 | putBinerAPI18(data, key, value);
86 | } else {
87 | putBinerAPI10(data, key, value);
88 | }
89 | }
90 |
91 | private static void putBinerAPI10(Bundle data, String key, IBinder value) {
92 | //public void putIBinder(String key, IBinder value)
93 | try {
94 | Method putIBinder = null;
95 | try {
96 | putIBinder = Bundle.class.getDeclaredMethod("putIBinder", String.class, IBinder.class);
97 | } catch (NoSuchMethodException e) {
98 | }
99 | if (putIBinder == null) {
100 | putIBinder = Bundle.class.getMethod("putIBinder", String.class, IBinder.class);
101 | }
102 | putIBinder.invoke(data, key, value);
103 | } catch (Exception e) {
104 | RuntimeException exception = new RuntimeException(e);
105 | exception.initCause(e);
106 | throw exception;
107 | }
108 | }
109 |
110 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
111 | private static void putBinerAPI18(Bundle data, String key, IBinder value) {
112 | data.putBinder(key, value);
113 | }
114 |
115 |
116 | private static void typeWarning(String key, Object value, String className,
117 | ClassCastException e) {
118 | typeWarning(key, value, className, "", e);
119 | }
120 |
121 | private static void typeWarning(String key, Object value, String className,
122 | Object defaultValue, ClassCastException e) {
123 | StringBuilder sb = new StringBuilder();
124 | sb.append("Key ");
125 | sb.append(key);
126 | sb.append(" expected ");
127 | sb.append(className);
128 | sb.append(" but value was a ");
129 | sb.append(value.getClass().getName());
130 | sb.append(". The default value ");
131 | sb.append(defaultValue);
132 | sb.append(" was returned.");
133 | Log.w(TAG, sb.toString());
134 | Log.w(TAG, "Attempt to cast generated internal exception:", e);
135 | }
136 | }
137 |
138 |
139 | }
140 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/java/com/morgoo/droidservices/ContentProviderBinderTransact.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservices;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.os.IBinder;
7 |
8 | /**
9 | * Created by zhangyong232@gmail.com on 2016/3/9.
10 | */
11 | class ContentProviderBinderTransact {
12 |
13 | static final String METHOD_GET_SERVICE_MANAGER = "GetServiceManager";
14 | static final String EXTRA_BINDER = "com.morgoo.droidservice.EXTRA_BINDER";
15 |
16 | static IBinder getBinder(Context context, Uri mUri) {
17 | Bundle extra = new Bundle();
18 | extra.setClassLoader(context.getClassLoader());
19 | Bundle data = CompatUtils.ContentResolverCompat.call(context.getContentResolver(), mUri, METHOD_GET_SERVICE_MANAGER, null, extra);
20 | return CompatUtils.BundleCompat.getBinder(data, EXTRA_BINDER);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/java/com/morgoo/droidservices/IServiceManagerImpl.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservices;
2 |
3 | import android.content.ComponentName;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.ServiceConnection;
7 | import android.os.Binder;
8 | import android.os.IBinder;
9 | import android.os.Looper;
10 | import android.os.RemoteException;
11 | import android.util.Log;
12 |
13 | import java.util.HashMap;
14 | import java.util.Map;
15 | import java.util.concurrent.BlockingQueue;
16 | import java.util.concurrent.LinkedBlockingQueue;
17 |
18 | /**
19 | * Created by zhangyong232@gmail.com on 2016/3/9.
20 | */
21 | class IServiceManagerImpl extends IServiceManager.Stub {
22 |
23 | private Map sAliveServices = new HashMap<>();
24 | private Map sDiedServices = new HashMap<>();
25 |
26 | private Context mContext;
27 |
28 | IServiceManagerImpl(Context context) {
29 | mContext = context;
30 | }
31 |
32 | @Override
33 | public synchronized void addService(final String callingPackageName, final String name, final IBinder binder) throws RemoteException {
34 | if (sAliveServices.containsKey(name)) {
35 | ServiceItem item = sAliveServices.get(name);
36 | throw new RuntimeException(String.format("Service %s has registed by pid:%s,uid:%s", name, item.callingPid, item.callingUid));
37 | }
38 |
39 | IBinder.DeathRecipient recipient = new DeathRecipient() {
40 | @Override
41 | public void binderDied() {
42 | ServiceItem item = sAliveServices.remove(name);
43 | if (item != null) {
44 | sDiedServices.put(name, item);
45 | }
46 | }
47 | };
48 |
49 | final ServiceItem item = new ServiceItem(name, binder, null, recipient, callingPackageName, Binder.getCallingPid(), Binder.getCallingUid());
50 | sAliveServices.put(name, item);
51 | sDiedServices.remove(name);
52 | item.linkToDeath();
53 | }
54 |
55 | @Override
56 | public void addIntentService(String callingPackageName, String name, Intent intent) throws RemoteException {
57 | //TODO
58 | RemoteException remoteException = new RemoteException();
59 | remoteException.initCause(new UnsupportedOperationException());
60 | throw remoteException;
61 | }
62 |
63 | private static void ensureNotOnMainThread() {
64 | Looper looper = Looper.myLooper();
65 | if (looper != null && looper == Looper.getMainLooper()) {
66 | throw new IllegalStateException(
67 | "calling this from your main thread can lead to deadlock");
68 | }
69 | }
70 |
71 | private IBinder connectToService(Context context, Intent service) throws InterruptedException {
72 | if (context == null) {
73 | throw new NullPointerException("context == null");
74 | }
75 | ensureNotOnMainThread();
76 | final BlockingQueue q = new LinkedBlockingQueue(1);
77 | ServiceConnection serviceConnection = new ServiceConnection() {
78 | volatile boolean mConnectedAtLeastOnce = false;
79 |
80 | @Override
81 | public void onServiceConnected(ComponentName name, IBinder service) {
82 | if (!mConnectedAtLeastOnce) {
83 | mConnectedAtLeastOnce = true;
84 | try {
85 | q.put(service);
86 | } catch (InterruptedException e) {
87 | // will never happen, since the queue starts with one available slot
88 | }
89 | }
90 | }
91 |
92 | @Override
93 | public void onServiceDisconnected(ComponentName name) {
94 | }
95 | };
96 | boolean isBound = context.bindService(service,
97 | serviceConnection,
98 | Context.BIND_AUTO_CREATE);
99 | if (!isBound) {
100 | throw new RuntimeException("Could not bind to Service:" + service);
101 | }
102 | return q.take();
103 | }
104 |
105 | @Override
106 | public IBinder getService(final String callingPackageName, final String name) throws RemoteException {
107 | ServiceItem item = sAliveServices.get(name);
108 | if (item == null) {
109 | item = sDiedServices.get(name);
110 | }
111 | if (item != null) {
112 | return item.binder;
113 | }
114 | Log.e("IServiceManagerImpl", "getService in :" + Thread.currentThread() + ",l=" + Looper.myLooper());
115 | return null;
116 | }
117 |
118 |
119 | @Override
120 | public void removeService(final String callingPackageName, final String name) throws RemoteException {
121 | ServiceItem item = sAliveServices.remove(name);
122 | if (item != null) {
123 | item.unlinkToDeath();
124 | }
125 | sDiedServices.remove(name);
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/java/com/morgoo/droidservices/ServiceItem.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservices;
2 |
3 | import android.content.Intent;
4 | import android.os.IBinder;
5 | import android.os.RemoteException;
6 |
7 | /**
8 | * Created by zhangyong232@gmail.com on 2016/3/9.
9 | */
10 | class ServiceItem {
11 |
12 | final String name;
13 | final int callingPid;
14 | final int callingUid;
15 | final IBinder binder;
16 | final Intent intent;
17 |
18 | IBinder.DeathRecipient recipient;
19 |
20 | ServiceItem(String name, IBinder binder, Intent intent, IBinder.DeathRecipient recipient, String callingPackage, int callingPid, int callingUid) {
21 | this.name = name;
22 | this.callingPid = callingPid;
23 | this.callingUid = callingUid;
24 | this.binder = binder;
25 | this.intent = intent;
26 | this.recipient = recipient;
27 | }
28 |
29 | void linkToDeath() throws RemoteException {
30 | if (binder != null && recipient != null) {
31 | binder.linkToDeath(recipient, 0);
32 | }
33 | }
34 |
35 | void unlinkToDeath() {
36 | if (binder != null && recipient != null) {
37 | binder.unlinkToDeath(recipient, 0);
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/java/com/morgoo/droidservices/ServiceManager.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservices;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.IBinder;
7 | import android.os.RemoteException;
8 |
9 | /**
10 | * 服务器管理器。
11 | * 对于任意的服务提供者,都可以向该服务系统中注册服务。
12 | * 服务注册有两种方式:
13 | * 1、直接注册:ServiceManager.getInstance().registerService(Context context, String name, IBinder binder);
14 | * 2、间接注册:ServiceManager.getInstance().registerService(Context context, String name, Intent intent);
15 | *
16 | * Created by zhangyong232@gmail.com on 2016/3/9.
17 | */
18 | public class ServiceManager {
19 |
20 |
21 | private ServiceManager() {
22 |
23 | }
24 |
25 |
26 | private static class SingleHodler {
27 | private static final ServiceManager sInstance = new ServiceManager();
28 | }
29 |
30 |
31 | public static ServiceManager getInstance() {
32 | return SingleHodler.sInstance;
33 | }
34 |
35 |
36 | private IServiceManager sIServiceManager;
37 |
38 |
39 | private synchronized void doGetIServiceManager(final Context context) throws RemoteException {
40 | if (sIServiceManager == null) {
41 | IBinder binder = ContentProviderBinderTransact.getBinder(context, mUri);
42 | binder.linkToDeath(new IBinder.DeathRecipient() {
43 | @Override
44 | public void binderDied() {
45 | try {
46 | doGetIServiceManager(context);
47 | } catch (RemoteException e) {
48 | e.printStackTrace();
49 | }
50 | }
51 | }, 0);
52 | sIServiceManager = IServiceManager.Stub.asInterface(binder);
53 | }
54 | }
55 |
56 | private IServiceManager getIServiceManager(Context context) throws RemoteException {
57 | doGetIServiceManager(context);
58 | return sIServiceManager;
59 | }
60 |
61 | private Uri mUri = Uri.parse("content://com.morgoo.droidservice/");
62 |
63 | public void setAuthorities(String authorities) {
64 | mUri = Uri.parse("content://" + authorities + "/");
65 | }
66 |
67 | public void registerService(final Context context, final String name, IBinder binder) throws RemoteException {
68 | getIServiceManager(context).addService(context.getPackageName(), name, binder);
69 | }
70 |
71 | public void registerService(final Context context, final String name, Intent intent) throws RemoteException {
72 | getIServiceManager(context).addIntentService(context.getPackageName(), name, intent);
73 | }
74 |
75 | public void unregisterService(final Context context, final String name) throws RemoteException {
76 | getIServiceManager(context).removeService(context.getPackageName(), name);
77 | }
78 |
79 | public void getService(final Context context, final String name) throws RemoteException {
80 | getIServiceManager(context).getService(context.getPackageName(), name);
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DroidServices
3 |
4 |
--------------------------------------------------------------------------------
/DroidService/Libraries/droidservices/src/test/java/com/morgoo/droidservices/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservices;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/DroidService/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.morgoo.droidservicetest"
9 | minSdkVersion 10
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.1'
26 | compile 'com.android.support:design:23.1.1'
27 | compile project(':Libraries:droidservices')
28 | }
29 |
--------------------------------------------------------------------------------
/DroidService/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Program_Files\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/DroidService/app/src/androidTest/java/com/morgoo/droidservicetest/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservicetest;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/DroidService/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/java/com/morgoo/droidservicetest/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservicetest;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.Snackbar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.View;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
19 | setSupportActionBar(toolbar);
20 |
21 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
22 | fab.setOnClickListener(new View.OnClickListener() {
23 | @Override
24 | public void onClick(View view) {
25 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
26 | .setAction("Action", null).show();
27 | }
28 | });
29 | }
30 |
31 | @Override
32 | public boolean onCreateOptionsMenu(Menu menu) {
33 | // Inflate the menu; this adds items to the action bar if it is present.
34 | getMenuInflater().inflate(R.menu.menu_main, menu);
35 | return true;
36 | }
37 |
38 | @Override
39 | public boolean onOptionsItemSelected(MenuItem item) {
40 | // Handle action bar item clicks here. The action bar will
41 | // automatically handle clicks on the Home/Up button, so long
42 | // as you specify a parent activity in AndroidManifest.xml.
43 | int id = item.getItemId();
44 |
45 | //noinspection SimplifiableIfStatement
46 | if (id == R.id.action_settings) {
47 | return true;
48 | }
49 |
50 | return super.onOptionsItemSelected(item);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/java/com/morgoo/droidservicetest/MainActivityFragment.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservicetest;
2 |
3 | import android.os.Bundle;
4 | import android.os.RemoteException;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.morgoo.droidservices.ServiceManager;
11 |
12 | /**
13 | * A placeholder fragment containing a simple view.
14 | */
15 | public class MainActivityFragment extends Fragment {
16 |
17 | public MainActivityFragment() {
18 | }
19 |
20 | @Override
21 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
22 | Bundle savedInstanceState) {
23 | View view = inflater.inflate(R.layout.fragment_main, container, false);
24 | try {
25 | ServiceManager.getInstance().setAuthorities("com.morgoo.droidservicetest.CoreContentProvider");
26 | ServiceManager.getInstance().getService(getActivity(), "haa");
27 | } catch (RemoteException e) {
28 | e.printStackTrace();
29 | }
30 | return view;
31 | }
32 |
33 | @Override
34 | public void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/layout/fragment_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cmzy/DroidService/a098d65cbd11de3057628a0cdf3f15312bd8c98a/DroidService/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cmzy/DroidService/a098d65cbd11de3057628a0cdf3f15312bd8c98a/DroidService/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cmzy/DroidService/a098d65cbd11de3057628a0cdf3f15312bd8c98a/DroidService/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cmzy/DroidService/a098d65cbd11de3057628a0cdf3f15312bd8c98a/DroidService/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cmzy/DroidService/a098d65cbd11de3057628a0cdf3f15312bd8c98a/DroidService/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DroidServiceTest
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/DroidService/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/DroidService/app/src/test/java/com/morgoo/droidservicetest/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.morgoo.droidservicetest;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/DroidService/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
25 |
26 | allprojects.each { p ->
27 | p.buildDir "bin"
28 | }
29 |
30 | rootProject.buildDir "bin"
31 |
--------------------------------------------------------------------------------
/DroidService/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 10:34:22 CST 2016
16 | systemProp.http.proxyHost=10.16.13.18
17 | systemProp.http.proxyPort=8080
18 |
--------------------------------------------------------------------------------
/DroidService/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/DroidService/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 |
--------------------------------------------------------------------------------
/DroidService/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | include ':Libraries:droidservices'
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | Droid Service
2 | ======
3 |
4 | 这是一个基于Android的应用层服务管理框架,主要用来方便的实现APP组件之间的通讯。
5 |
6 | 此框架类似于Android系统的ServiceManager,但是不需要root权限。
7 |
8 | 任何组件都可以向框架中注册自己提供的服务,其它组件则可以向框架获取这些服务并使用。
9 |
10 | -------
11 |
12 |
13 |
--------------------------------------------------------------------------------