OSDN Git Service

Revert "Revert "Remove getAppsUsingPermisisons""
authorvinodkrishnan <vinodkrishnan@google.com>
Wed, 1 Feb 2017 00:37:36 +0000 (00:37 +0000)
committerVinod Krishnan <vinodkrishnan@google.com>
Wed, 1 Feb 2017 00:59:46 +0000 (16:59 -0800)
This reverts commit a69c99fbc73fd092ba42b797d691f456dc1df1ef.

Change-Id: I524a56ae3cd0d1a9dbd0e54fd7e57f09ed0b87f9

api/system-current.txt
core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl
core/java/android/content/pm/permission/RuntimePermissionPresenter.java
core/java/android/permissionpresenterservice/RuntimePermissionPresenterService.java

index 594fa2e..1311240 100644 (file)
@@ -33725,7 +33725,6 @@ package android.permissionpresenterservice {
     method public final void attachBaseContext(android.content.Context);
     method public final android.os.IBinder onBind(android.content.Intent);
     method public abstract java.util.List<android.content.pm.permission.RuntimePermissionPresentationInfo> onGetAppPermissions(java.lang.String);
-    method public abstract java.util.List<android.content.pm.ApplicationInfo> onGetAppsUsingPermissions(boolean);
     field public static final java.lang.String SERVICE_INTERFACE = "android.permissionpresenterservice.RuntimePermissionPresenterService";
   }
 
index 8766508..3c3b84d 100644 (file)
@@ -25,5 +25,4 @@ import android.os.RemoteCallback;
  */
 oneway interface IRuntimePermissionPresenter {
     void getAppPermissions(String packageName, in RemoteCallback callback);
-    void getAppsUsingPermissions(boolean system, in RemoteCallback callback);
-}
\ No newline at end of file
+}
index 2e39926..6d55d2f 100644 (file)
@@ -72,15 +72,6 @@ public final class RuntimePermissionPresenter {
                 List<RuntimePermissionPresentationInfo> permissions) {
             /* do nothing - stub */
         }
-
-        /**
-         * The result for {@link #getAppsUsingPermissions(boolean, List)}.
-         * @param system Whether to return only the system apps or only the non-system ones.
-         * @param apps The apps using runtime permissions.
-         */
-        public void getAppsUsingPermissions(boolean system, @NonNull List<ApplicationInfo> apps) {
-            /* do nothing - stub */
-        }
     }
 
     private static final Object sLock = new Object();
@@ -127,29 +118,6 @@ public final class RuntimePermissionPresenter {
         mRemoteService.processMessage(message);
     }
 
-    /**
-     * Gets the system apps that use runtime permissions. System apps are ones
-     * that are considered system for presentation purposes instead of ones
-     * that are preinstalled on the system image. System apps are ones that
-     * are on the system image, haven't been updated (a.k.a factory apps)
-     * that do not have a launcher icon.
-     *
-     * @param system If true only system apps are returned otherwise only
-     *        non-system ones are returned.
-     * @param callback Callback to receive the result.
-     * @param handler Handler on which to invoke the callback.
-     */
-    public void getAppsUsingPermissions(boolean system, @NonNull OnResultCallback callback,
-            @Nullable Handler handler) {
-        SomeArgs args = SomeArgs.obtain();
-        args.arg1 = callback;
-        args.arg2 = handler;
-        args.argi1 = system ? 1 : 0;
-        Message message = mRemoteService.obtainMessage(
-                RemoteService.MSG_GET_APPS_USING_PERMISSIONS, args);
-        mRemoteService.processMessage(message);
-    }
-
     private static final class RemoteService
             extends Handler implements ServiceConnection {
         private static final long UNBIND_TIMEOUT_MILLIS = 10000;
@@ -254,51 +222,6 @@ public final class RuntimePermissionPresenter {
                     scheduleUnbind();
                 } break;
 
-                case MSG_GET_APPS_USING_PERMISSIONS: {
-                    SomeArgs args = (SomeArgs) msg.obj;
-                    final OnResultCallback callback = (OnResultCallback) args.arg1;
-                    final Handler handler = (Handler) args.arg2;
-                    final boolean system = args.argi1 == 1;
-                    args.recycle();
-                    final IRuntimePermissionPresenter remoteInstance;
-                    synchronized (mLock) {
-                        remoteInstance = mRemoteInstance;
-                    }
-                    if (remoteInstance == null) {
-                        return;
-                    }
-                    try {
-                        remoteInstance.getAppsUsingPermissions(system, new RemoteCallback(
-                                new RemoteCallback.OnResultListener() {
-                            @Override
-                            public void onResult(Bundle result) {
-                                final List<ApplicationInfo> reportedApps;
-                                List<ApplicationInfo> apps = null;
-                                if (result != null) {
-                                    apps = result.getParcelableArrayList(KEY_RESULT);
-                                }
-                                if (apps == null) {
-                                    apps = Collections.emptyList();
-                                }
-                                reportedApps = apps;
-                                if (handler != null) {
-                                    handler.post(new Runnable() {
-                                        @Override
-                                        public void run() {
-                                            callback.getAppsUsingPermissions(system, reportedApps);
-                                        }
-                                    });
-                                } else {
-                                    callback.getAppsUsingPermissions(system, reportedApps);
-                                }
-                            }
-                        }, this));
-                    } catch (RemoteException re) {
-                        Log.e(TAG, "Error getting apps using permissions", re);
-                    }
-                    scheduleUnbind();
-                } break;
-
                 case MSG_UNBIND: {
                     synchronized (mLock) {
                         if (mBound) {
index 405be1a..344d947 100644 (file)
@@ -72,14 +72,6 @@ public abstract class RuntimePermissionPresenterService extends Service {
      */
     public abstract List<RuntimePermissionPresentationInfo> onGetAppPermissions(String packageName);
 
-    /**
-     * Gets the apps that use runtime permissions.
-     *
-     * @param system Whether to return only the system apps or only the non-system ones.
-     * @return The app list.
-     */
-    public abstract List<ApplicationInfo> onGetAppsUsingPermissions(boolean system);
-
     @Override
     public final IBinder onBind(Intent intent) {
         return new IRuntimePermissionPresenter.Stub() {
@@ -91,12 +83,6 @@ public abstract class RuntimePermissionPresenterService extends Service {
                 mHandler.obtainMessage(MyHandler.MSG_GET_APP_PERMISSIONS,
                         args).sendToTarget();
             }
-
-            @Override
-            public void getAppsUsingPermissions(boolean system, RemoteCallback callback) {
-                mHandler.obtainMessage(MyHandler.MSG_GET_APPS_USING_PERMISSIONS,
-                        system ? 1 : 0, 0, callback).sendToTarget();
-            }
         };
     }
 
@@ -127,19 +113,6 @@ public abstract class RuntimePermissionPresenterService extends Service {
                         callback.sendResult(null);
                     }
                 } break;
-
-                case MSG_GET_APPS_USING_PERMISSIONS: {
-                    RemoteCallback callback = (RemoteCallback) msg.obj;
-                    final boolean system = msg.arg1 == 1;
-                    List<ApplicationInfo> apps = onGetAppsUsingPermissions(system);
-                    if (apps != null && !apps.isEmpty()) {
-                        Bundle result = new Bundle();
-                        result.putParcelableList(RuntimePermissionPresenter.KEY_RESULT, apps);
-                        callback.sendResult(result);
-                    } else {
-                        callback.sendResult(null);
-                    }
-                } break;
             }
         }
     }