From 495d891198ab32b2584783ee5e859bf59a8792d3 Mon Sep 17 00:00:00 2001 From: vinodkrishnan Date: Wed, 1 Feb 2017 00:37:36 +0000 Subject: [PATCH] Revert "Revert "Remove getAppsUsingPermisisons"" This reverts commit a69c99fbc73fd092ba42b797d691f456dc1df1ef. Change-Id: I524a56ae3cd0d1a9dbd0e54fd7e57f09ed0b87f9 --- api/system-current.txt | 1 - .../IRuntimePermissionPresenter.aidl | 3 +- .../RuntimePermissionPresenter.java | 77 ------------------- .../RuntimePermissionPresenterService.java | 27 ------- 4 files changed, 1 insertion(+), 107 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 594fa2ecac713..13112403f13cb 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -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 onGetAppPermissions(java.lang.String); - method public abstract java.util.List onGetAppsUsingPermissions(boolean); field public static final java.lang.String SERVICE_INTERFACE = "android.permissionpresenterservice.RuntimePermissionPresenterService"; } diff --git a/core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl b/core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl index 8766508a5c897..3c3b84d7b2a3e 100644 --- a/core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl +++ b/core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl @@ -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 +} diff --git a/core/java/android/content/pm/permission/RuntimePermissionPresenter.java b/core/java/android/content/pm/permission/RuntimePermissionPresenter.java index 2e39926422fe5..6d55d2f7a8605 100644 --- a/core/java/android/content/pm/permission/RuntimePermissionPresenter.java +++ b/core/java/android/content/pm/permission/RuntimePermissionPresenter.java @@ -72,15 +72,6 @@ public final class RuntimePermissionPresenter { List 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 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 reportedApps; - List 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) { diff --git a/core/java/android/permissionpresenterservice/RuntimePermissionPresenterService.java b/core/java/android/permissionpresenterservice/RuntimePermissionPresenterService.java index 405be1a2520c7..344d947a3ad38 100644 --- a/core/java/android/permissionpresenterservice/RuntimePermissionPresenterService.java +++ b/core/java/android/permissionpresenterservice/RuntimePermissionPresenterService.java @@ -72,14 +72,6 @@ public abstract class RuntimePermissionPresenterService extends Service { */ public abstract List 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 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 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; } } }