Merge "Lock Private space at the end of PS setup." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
bd0eb0dd31
@@ -34,6 +34,7 @@ import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
|
||||
@@ -226,6 +227,26 @@ public class PrivateSpaceMaintainer {
|
||||
HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if private space exists and quiet mode is successfully enabled, otherwise
|
||||
* returns false
|
||||
*/
|
||||
public synchronized boolean lockPrivateSpace() {
|
||||
if (isPrivateProfileRunning()) {
|
||||
return mUserManager.requestQuietModeEnabled(true, mUserHandle);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns true if private space exists and is running, otherwise returns false */
|
||||
@VisibleForTesting
|
||||
synchronized boolean isPrivateProfileRunning() {
|
||||
if (doesPrivateSpaceExist() && mUserHandle != null) {
|
||||
return mUserManager.isUserRunning(mUserHandle);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void resetPrivateSpaceSettings() {
|
||||
setHidePrivateSpaceEntryPointSetting(HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ public class SetupSuccessFragment extends InstrumentedFragment {
|
||||
if (activity != null) {
|
||||
mMetricsFeatureProvider.action(
|
||||
getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_DONE);
|
||||
//TODO(b/307729746): Add a test to verify PS is locked after setup completion.
|
||||
PrivateSpaceMaintainer.getInstance(activity).lockPrivateSpace();
|
||||
Intent allAppsIntent = new Intent(Intent.ACTION_ALL_APPS);
|
||||
ResolveInfo resolveInfo =
|
||||
activity.getPackageManager()
|
||||
|
||||
Reference in New Issue
Block a user