Add a feature flag for the special access to the long background task

The entry should be hidden if the RUN_LONG_JOBS can't be toggled.

Bug: 255821578
Test: atest AppFilterRegistryTest
Test: make -j RunSettingsRoboTests \
ROBOTTEST_FILTER="LongBackgroundTasksDetailsTest|
LongBackgroundTasksDetailsPreferenceControllerTest"
Test: Manually check the Settings page

Change-Id: Ib1c58d93b40afefdf3ca666c661e213d01c542c6
This commit is contained in:
Jing Ji
2023-01-06 02:10:42 -08:00
parent d54c9cab7d
commit 50490a35ec
7 changed files with 83 additions and 4 deletions

View File

@@ -16,6 +16,10 @@
package com.android.settings.applications;
import static android.Manifest.permission.RUN_LONG_JOBS;
import static android.app.AppOpsManager.OP_RUN_LONG_JOBS;
import static android.app.AppOpsManager.opToPermission;
import android.Manifest;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
@@ -338,4 +342,9 @@ public class ApplicationFeatureProviderImpl implements ApplicationFeatureProvide
}
throw new IllegalStateException("Missing ComponentInfo!");
}
@Override
public boolean isLongBackgroundTaskPermissionToggleSupported() {
return TextUtils.equals(RUN_LONG_JOBS, opToPermission(OP_RUN_LONG_JOBS));
}
}