Put stricter flag checks
Also removed a log which gives away flag. Bug: 312976400 Test: manual Change-Id: I4a989de8b6b920666aabf0cc9311e28becc4d862
This commit is contained in:
@@ -92,6 +92,13 @@ public class AutoAdvanceSetupFragment extends Fragment {
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
if (android.os.Flags.allowPrivateProfile()) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater,
|
||||
|
@@ -53,7 +53,7 @@ public class DeletePrivateSpaceController extends BasePreferenceController {
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -38,7 +38,7 @@ public class HidePrivateSpaceController extends TogglePreferenceController {
|
||||
@Override
|
||||
@AvailabilityStatus
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.privatespace;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -24,6 +25,13 @@ import com.android.settings.dashboard.DashboardFragment;
|
||||
public class HidePrivateSpaceSettings extends DashboardFragment{
|
||||
private static final String TAG = "HidePrivateSpaceSettings";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
if (android.os.Flags.allowPrivateProfile()) {
|
||||
super.onCreate(icicle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.PRIVATE_SPACE_SETTINGS;
|
||||
|
@@ -36,7 +36,7 @@ public final class HidePrivateSpaceSummaryController extends BasePreferenceContr
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -52,6 +52,9 @@ public class PrivateProfileContextHelperActivity extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (!android.os.Flags.allowPrivateProfile()) {
|
||||
return;
|
||||
}
|
||||
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
||||
ThemeHelper.trySetDynamicColor(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@@ -66,9 +66,8 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (Flags.allowPrivateProfile()) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ThemeHelper.trySetDynamicColor(this);
|
||||
mPrivateSpaceMaintainer = new Injector().injectPrivateSpaceMaintainer(
|
||||
getApplicationContext());
|
||||
@@ -87,7 +86,6 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity {
|
||||
promptToSetDeviceLock();
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "allowPrivateProfile flag is Off!");
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.privatespace;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -25,6 +26,13 @@ import com.android.settings.dashboard.DashboardFragment;
|
||||
public class PrivateSpaceDashboardFragment extends DashboardFragment {
|
||||
private static final String TAG = "PrivateSpaceDashboardFragment";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
if (android.os.Flags.allowPrivateProfile()) {
|
||||
super.onCreate(icicle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.private_space_settings;
|
||||
|
@@ -39,6 +39,9 @@ public class PrivateSpaceEducation extends Fragment {
|
||||
LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (!android.os.Flags.allowPrivateProfile()) {
|
||||
return null;
|
||||
}
|
||||
GlifLayout rootView =
|
||||
(GlifLayout)
|
||||
inflater.inflate(R.layout.privatespace_education_screen, container, false);
|
||||
|
@@ -25,6 +25,7 @@ import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.os.Flags;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -68,6 +69,9 @@ public class PrivateSpaceMaintainer {
|
||||
* <p> This method should be used by the Private Space Setup Flow ONLY.
|
||||
*/
|
||||
final synchronized boolean createPrivateSpace() {
|
||||
if (!Flags.allowPrivateProfile()) {
|
||||
return false;
|
||||
}
|
||||
// Check if Private space already exists
|
||||
if (doesPrivateSpaceExist()) {
|
||||
return true;
|
||||
@@ -130,6 +134,9 @@ public class PrivateSpaceMaintainer {
|
||||
|
||||
/** Returns true if the Private space exists. */
|
||||
public synchronized boolean doesPrivateSpaceExist() {
|
||||
if (!Flags.allowPrivateProfile()) {
|
||||
return false;
|
||||
}
|
||||
if (mUserHandle != null) {
|
||||
return true;
|
||||
}
|
||||
|
@@ -47,6 +47,9 @@ public class PrivateSpaceSetLockFragment extends Fragment {
|
||||
LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (!android.os.Flags.allowPrivateProfile()) {
|
||||
return null;
|
||||
}
|
||||
GlifLayout rootView =
|
||||
(GlifLayout) inflater.inflate(
|
||||
R.layout.privatespace_setlock_screen, container, false);
|
||||
|
@@ -36,6 +36,9 @@ public class PrivateSpaceSetupActivity extends FragmentActivity {
|
||||
private NavHostFragment mNavHostFragment;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (!android.os.Flags.allowPrivateProfile()) {
|
||||
return;
|
||||
}
|
||||
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
||||
ThemeHelper.trySetDynamicColor(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@@ -45,6 +45,9 @@ public class SetupSuccessFragment extends Fragment {
|
||||
LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
if (!android.os.Flags.allowPrivateProfile()) {
|
||||
return null;
|
||||
}
|
||||
GlifLayout rootView =
|
||||
(GlifLayout)
|
||||
inflater.inflate(R.layout.privatespace_setup_success, container, false);
|
||||
|
@@ -35,7 +35,7 @@ public class FaceFingerprintUnlockController extends AbstractPreferenceControlle
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return false;
|
||||
return android.os.Flags.allowPrivateProfile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -73,7 +73,7 @@ public class PrivateSpaceLockController extends AbstractPreferenceController {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
return android.os.Flags.allowPrivateProfile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -45,7 +45,7 @@ public class UseOneLockController extends BasePreferenceController {
|
||||
}
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -94,7 +94,7 @@ public class UseOneLockControllerSwitch extends AbstractPreferenceController
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
return android.os.Flags.allowPrivateProfile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings.privatespace.onelock;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -34,6 +35,13 @@ public class UseOneLockSettingsFragment extends DashboardFragment {
|
||||
public static final int UNIFY_PRIVATE_LOCK_WITH_DEVICE_REQUEST = 1;
|
||||
public static final int UNUNIFY_PRIVATE_LOCK_FROM_DEVICE_REQUEST = 2;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
if (android.os.Flags.allowPrivateProfile()) {
|
||||
super.onCreate(icicle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.PRIVATE_SPACE_SETTINGS;
|
||||
|
Reference in New Issue
Block a user