Always review permissions before <M app is started the first time
This splits the
- review permissions
- individually control permissions
- consent to manage wireleess (wifi + bluetooth)
properties.
Almost all code cares only for the first and it is now always true.
Hence a lot of code can be simplified.
Bug: 110431654
Test: atest PermissionsHostTest
started pre-M app
Change-Id: I733cd476ccd0bf5eaa59e9a9506db34f57c6baee
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
index 19a3e4a..f07e503 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
@@ -41,6 +41,7 @@
import android.content.pm.ActivityInfo.WindowLayout;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
+import android.content.pm.PackageManagerInternal;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.RemoteException;
@@ -327,6 +328,16 @@
doReturn(stack).when(mService.mStackSupervisor)
.getLaunchStack(any(), any(), any(), anyBoolean(), anyInt());
+ // Set up mock package manager internal and make sure no unmocked methods are called
+ PackageManagerInternal mockPackageManager = mock(PackageManagerInternal.class,
+ invocation -> {
+ throw new RuntimeException("Not stubbed");
+ });
+ doReturn(mockPackageManager).when(mService.mAm).getPackageManagerInternalLocked();
+
+ // Never review permissions
+ doReturn(false).when(mockPackageManager).isPermissionsReviewRequired(any(), anyInt());
+
final Intent intent = new Intent();
intent.addFlags(launchFlags);
intent.setComponent(ActivityBuilder.getDefaultComponent());