Lock Private space at the end of PS setup.
This change is to call UserManager requestQuietModeEnabled() API at the end of PS setup to enable quitemode for private space. Bug: 313652502 Test: atest PrivateSpaceMaintainerTest Verify Private space is locked state after private space setup completion. Change-Id: I1d863f6d51ffa4bb58318696603905d35c3109b6
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user