Commit 1ed230e7 authored by /e/ robot's avatar /e/ robot

Merge remote-tracking branch 'origin/lineage-15.1' into v1-oreo

parents a3868292 a42a6c60
Pipeline #27799 passed with stage
in 8 minutes and 12 seconds
......@@ -94,8 +94,6 @@ public class AppStateInstallAppsBridge extends AppStateBaseBridge {
final InstallAppsState appState = new InstallAppsState();
appState.permissionRequested = hasRequestedAppOpPermission(
Manifest.permission.REQUEST_INSTALL_PACKAGES, packageName);
appState.permissionGranted = hasPermission(Manifest.permission.REQUEST_INSTALL_PACKAGES,
uid);
appState.appOpMode = getAppOpMode(AppOpsManager.OP_REQUEST_INSTALL_PACKAGES, uid,
packageName);
return appState;
......@@ -106,7 +104,6 @@ public class AppStateInstallAppsBridge extends AppStateBaseBridge {
*/
public static class InstallAppsState {
boolean permissionRequested;
boolean permissionGranted;
int appOpMode;
public InstallAppsState() {
......@@ -114,11 +111,7 @@ public class AppStateInstallAppsBridge extends AppStateBaseBridge {
}
public boolean canInstallApps() {
if (appOpMode == AppOpsManager.MODE_DEFAULT) {
return permissionGranted;
} else {
return appOpMode == AppOpsManager.MODE_ALLOWED;
}
return appOpMode == AppOpsManager.MODE_ALLOWED;
}
public boolean isPotentialAppSource() {
......@@ -127,8 +120,8 @@ public class AppStateInstallAppsBridge extends AppStateBaseBridge {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("[permissionGranted: " + permissionGranted);
sb.append(", permissionRequested: " + permissionRequested);
StringBuilder sb = new StringBuilder();
sb.append("[permissionRequested: " + permissionRequested);
sb.append(", appOpMode: " + appOpMode);
sb.append("]");
return sb.toString();
......
......@@ -37,8 +37,10 @@ public class AppStateInstallAppsBridgeTest {
.InstallAppsState();
assertThat(appState.canInstallApps()).isFalse();
appState.permissionGranted = true;
appState.permissionRequested = true;
assertThat(appState.canInstallApps()).isFalse();
appState.appOpMode = AppOpsManager.MODE_ALLOWED;
assertThat(appState.canInstallApps()).isTrue();
appState.appOpMode = AppOpsManager.MODE_ERRORED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment