Update references to the RUN_LONG_JOBS permission.
The permission has been renamed to RUN_USER_INITIATED_JOBS. Bug: 255038128 Test: build/manual Change-Id: Ia32a6d564d62b2c0318c7afbd6de0ad9644e52d0
This commit is contained in:
@@ -437,7 +437,7 @@ public class Settings extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Actviity to manage apps with {@link android.Manifest.permission#RUN_LONG_JOBS} */
|
/** Actviity to manage apps with {@link android.Manifest.permission#RUN_USER_INITIATED_JOBS} */
|
||||||
public static class LongBackgroundTasksActivity extends SettingsActivity { /* empty */ }
|
public static class LongBackgroundTasksActivity extends SettingsActivity { /* empty */ }
|
||||||
/** App specific version of {@link LongBackgroundTasksActivity} */
|
/** App specific version of {@link LongBackgroundTasksActivity} */
|
||||||
public static class LongBackgroundTasksAppActivity extends SettingsActivity { /* empty */ }
|
public static class LongBackgroundTasksAppActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@@ -37,11 +37,11 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects app op info to the ApplicationsState. Extends {@link AppStateAppOpsBridge} to tailor
|
* Connects app op info to the ApplicationsState. Extends {@link AppStateAppOpsBridge} to tailor
|
||||||
* to the semantics of {@link Manifest.permission#RUN_LONG_JOBS}.
|
* to the semantics of {@link Manifest.permission#RUN_USER_INITIATED_JOBS}.
|
||||||
* Also provides app filters that can use the info.
|
* Also provides app filters that can use the info.
|
||||||
*/
|
*/
|
||||||
public class AppStateLongBackgroundTasksBridge extends AppStateBaseBridge {
|
public class AppStateLongBackgroundTasksBridge extends AppStateBaseBridge {
|
||||||
private static final String PERMISSION = Manifest.permission.RUN_LONG_JOBS;
|
private static final String PERMISSION = Manifest.permission.RUN_USER_INITIATED_JOBS;
|
||||||
private static final String TAG = "LongBackgroundTasksBridge";
|
private static final String TAG = "LongBackgroundTasksBridge";
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -64,15 +64,15 @@ public class AppStateLongBackgroundTasksBridge extends AppStateBaseBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information regarding {@link Manifest.permission#RUN_LONG_JOBS} for the given
|
* Returns information regarding {@link Manifest.permission#RUN_USER_INITIATED_JOBS} for the
|
||||||
* package and uid.
|
* given package and uid.
|
||||||
*/
|
*/
|
||||||
public LongBackgroundTasksState createPermissionState(String packageName, int uid) {
|
public LongBackgroundTasksState createPermissionState(String packageName, int uid) {
|
||||||
final int userId = UserHandle.getUserId(uid);
|
final int userId = UserHandle.getUserId(uid);
|
||||||
|
|
||||||
final boolean permissionRequested = ArrayUtils.contains(mRequesterPackages, packageName);
|
final boolean permissionRequested = ArrayUtils.contains(mRequesterPackages, packageName);
|
||||||
final boolean permissionGranted = mJobScheduler.hasRunLongJobsPermission(packageName,
|
final boolean permissionGranted = mJobScheduler.hasRunUserInitiatedJobsPermission(
|
||||||
userId);
|
packageName, userId);
|
||||||
return new LongBackgroundTasksState(permissionRequested, permissionGranted);
|
return new LongBackgroundTasksState(permissionRequested, permissionGranted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public class AppStateLongBackgroundTasksBridge extends AppStateBaseBridge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to denote the state of an app regarding
|
* Class to denote the state of an app regarding
|
||||||
* {@link Manifest.permission#RUN_LONG_JOBS}.
|
* {@link Manifest.permission#RUN_USER_INITIATED_JOBS}.
|
||||||
*/
|
*/
|
||||||
public static class LongBackgroundTasksState {
|
public static class LongBackgroundTasksState {
|
||||||
private boolean mPermissionRequested;
|
private boolean mPermissionRequested;
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.applications;
|
package com.android.settings.applications;
|
||||||
|
|
||||||
import static android.Manifest.permission.RUN_LONG_JOBS;
|
import static android.Manifest.permission.RUN_USER_INITIATED_JOBS;
|
||||||
import static android.app.AppOpsManager.OP_RUN_LONG_JOBS;
|
import static android.app.AppOpsManager.OP_RUN_USER_INITIATED_JOBS;
|
||||||
import static android.app.AppOpsManager.opToPermission;
|
import static android.app.AppOpsManager.opToPermission;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
@@ -345,6 +345,7 @@ public class ApplicationFeatureProviderImpl implements ApplicationFeatureProvide
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLongBackgroundTaskPermissionToggleSupported() {
|
public boolean isLongBackgroundTaskPermissionToggleSupported() {
|
||||||
return TextUtils.equals(RUN_LONG_JOBS, opToPermission(OP_RUN_LONG_JOBS));
|
return TextUtils.equals(RUN_USER_INITIATED_JOBS,
|
||||||
|
opToPermission(OP_RUN_USER_INITIATED_JOBS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ import com.android.settingslib.applications.ApplicationsState.AppEntry;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* App specific activity to show details about
|
* App specific activity to show details about
|
||||||
* {@link android.Manifest.permission#RUN_LONG_JOBS}.
|
* {@link android.Manifest.permission#RUN_USER_INITIATED_JOBS}.
|
||||||
*/
|
*/
|
||||||
public class LongBackgroundTasksDetails extends AppInfoWithHeader
|
public class LongBackgroundTasksDetails extends AppInfoWithHeader
|
||||||
implements OnPreferenceChangeListener {
|
implements OnPreferenceChangeListener {
|
||||||
@@ -52,7 +52,7 @@ public class LongBackgroundTasksDetails extends AppInfoWithHeader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the string that states whether the app has access to
|
* Returns the string that states whether the app has access to
|
||||||
* {@link android.Manifest.permission#RUN_LONG_JOBS}.
|
* {@link android.Manifest.permission#RUN_USER_INITIATED_JOBS}.
|
||||||
*/
|
*/
|
||||||
public static CharSequence getSummary(Context context, AppEntry entry) {
|
public static CharSequence getSummary(Context context, AppEntry entry) {
|
||||||
final AppStateLongBackgroundTasksBridge.LongBackgroundTasksState state =
|
final AppStateLongBackgroundTasksBridge.LongBackgroundTasksState state =
|
||||||
@@ -104,9 +104,9 @@ public class LongBackgroundTasksDetails extends AppInfoWithHeader
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCanRunLongJobs(boolean newState) {
|
private void setCanRunUserInitiatedJobs(boolean newState) {
|
||||||
final int uid = mPackageInfo.applicationInfo.uid;
|
final int uid = mPackageInfo.applicationInfo.uid;
|
||||||
mAppOpsManager.setUidMode(AppOpsManager.OPSTR_RUN_LONG_JOBS, uid,
|
mAppOpsManager.setUidMode(AppOpsManager.OPSTR_RUN_USER_INITIATED_JOBS, uid,
|
||||||
newState ? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_ERRORED);
|
newState ? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_ERRORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ public class LongBackgroundTasksDetails extends AppInfoWithHeader
|
|||||||
}
|
}
|
||||||
if (mPermissionState != null && mUncommittedState != null
|
if (mPermissionState != null && mUncommittedState != null
|
||||||
&& mUncommittedState != mPermissionState.isAllowed()) {
|
&& mUncommittedState != mPermissionState.isAllowed()) {
|
||||||
setCanRunLongJobs(mUncommittedState);
|
setCanRunUserInitiatedJobs(mUncommittedState);
|
||||||
logPermissionChange(mUncommittedState, mPackageName);
|
logPermissionChange(mUncommittedState, mPackageName);
|
||||||
mUncommittedState = null;
|
mUncommittedState = null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user