Use a separated flag for archiving feature in Settings
The new flag will replace the current PM-flag eventually, once they reach the same rollout status. Until then both flags are kept concurrently, to avoid a rollback of the feature.
This is done to reduce risk and potentially enable an isolated rollback
of Settings related logic, while keeping system logic intact.
Additionally, fix bug by replacing `System.getProperty("pm.archiving.enabled")` to `SystemProperties.getBoolean("pm.archiving.enabled", false)`
Test: InstalledAppCounterTest, AppButtonsTest, HibernationSwitchPreferenceTest
Bug: 323164382
Change-Id: I44a41d6a43a12134c4e3aa5df8ad6a9eb91758d4
This commit is contained in:
@@ -22,12 +22,15 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.ApplicationInfoFlags;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.flags.Flags;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AppCounter extends AsyncTask<Void, Void, Integer> {
|
||||
@@ -54,7 +57,7 @@ public abstract class AppCounter extends AsyncTask<Void, Void, Integer> {
|
||||
for (UserInfo user : mUm.getProfiles(UserHandle.myUserId())) {
|
||||
long flags = PackageManager.GET_DISABLED_COMPONENTS
|
||||
| PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS
|
||||
| (mFf.archiving() ? PackageManager.MATCH_ARCHIVED_PACKAGES : 0)
|
||||
| (isArchivingEnabled() ? PackageManager.MATCH_ARCHIVED_PACKAGES : 0)
|
||||
| (user.isAdmin() ? PackageManager.MATCH_ANY_USER : 0);
|
||||
ApplicationInfoFlags infoFlags = ApplicationInfoFlags.of(flags);
|
||||
final List<ApplicationInfo> list =
|
||||
@@ -68,6 +71,11 @@ public abstract class AppCounter extends AsyncTask<Void, Void, Integer> {
|
||||
return count;
|
||||
}
|
||||
|
||||
private boolean isArchivingEnabled() {
|
||||
return mFf.archiving() || SystemProperties.getBoolean("pm.archiving.enabled", false)
|
||||
|| Flags.appArchiving();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Integer count) {
|
||||
onCountComplete(count);
|
||||
|
||||
Reference in New Issue
Block a user