Merge "Handle startProfile failure during creation of private space" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
4868dbe243
@@ -112,11 +112,10 @@ public class PrivateSpaceMaintainer {
|
|||||||
|
|
||||||
registerBroadcastReceiver();
|
registerBroadcastReceiver();
|
||||||
|
|
||||||
try {
|
if (!startProfile()) {
|
||||||
//TODO(b/313926659): To check and handle failure of startProfile
|
// TODO(b/333884792): Add test to mock when startProfile fails.
|
||||||
mActivityManager.startProfile(mUserHandle);
|
Log.e(TAG, "profile not started, created profile is deleted");
|
||||||
} catch (IllegalArgumentException e) {
|
deletePrivateSpace();
|
||||||
Log.e(TAG, "Unexpected that " + mUserHandle.getIdentifier() + " is not a profile");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,6 +313,16 @@ public class PrivateSpaceMaintainer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GuardedBy("this")
|
||||||
|
private boolean startProfile() {
|
||||||
|
try {
|
||||||
|
return mActivityManager.startProfile(mUserHandle);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
Log.e(TAG, "Unexpected that " + mUserHandle.getIdentifier() + " is not a profile");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private void resetPrivateSpaceSettings() {
|
private void resetPrivateSpaceSettings() {
|
||||||
setHidePrivateSpaceEntryPointSetting(HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
setHidePrivateSpaceEntryPointSetting(HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL);
|
||||||
|
|||||||
Reference in New Issue
Block a user