diff --git a/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java b/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java index aa980eeaf28..96018196248 100644 --- a/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java +++ b/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java @@ -29,6 +29,7 @@ import static com.android.settings.privatespace.PrivateSpaceSetupActivity.SET_LO import android.app.KeyguardManager; import android.content.Intent; import android.os.Bundle; +import android.util.Log; import androidx.activity.result.ActivityResult; import androidx.activity.result.ActivityResultLauncher; @@ -42,16 +43,18 @@ import com.android.settings.overlay.FeatureFactory; import com.google.android.setupdesign.util.ThemeHelper; -/** Activity that is started as private profile user that helps to set private profile lock or - * add an account on the private profile. */ +/** + * Activity that is started as private profile user that helps to set private profile lock or add an + * account on the private profile. + */ public class PrivateProfileContextHelperActivity extends FragmentActivity { - private static final String TAG = "PrivateProfileHelper"; + private static final String TAG = "PrivateSpaceHelperAct"; private final ActivityResultLauncher mAddAccountToPrivateProfile = - registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), - this::onAccountAdded); + registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), this::onAccountAdded); private final ActivityResultLauncher mVerifyDeviceLock = - registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), - this::onSetDeviceNewLock); + registerForActivityResult( + new ActivityResultContracts.StartActivityForResult(), this::onSetDeviceNewLock); @Override protected void onCreate(Bundle savedInstanceState) { @@ -66,8 +69,8 @@ public class PrivateProfileContextHelperActivity extends FragmentActivity { if (action == ACCOUNT_LOGIN_ACTION) { PrivateSpaceLoginFeatureProvider privateSpaceLoginFeatureProvider = FeatureFactory.getFeatureFactory().getPrivateSpaceLoginFeatureProvider(); - if (!privateSpaceLoginFeatureProvider.initiateAccountLogin(this, - mAddAccountToPrivateProfile)) { + if (!privateSpaceLoginFeatureProvider.initiateAccountLogin( + this, mAddAccountToPrivateProfile)) { setResult(RESULT_OK); finish(); } @@ -90,8 +93,10 @@ public class PrivateProfileContextHelperActivity extends FragmentActivity { private void onAccountAdded(@Nullable ActivityResult result) { if (result != null && result.getResultCode() == RESULT_OK) { + Log.i(TAG, "private space account login success"); setResult(RESULT_OK); } else { + Log.i(TAG, "private space account login failed"); setResult(RESULT_CANCELED); } finish(); @@ -101,8 +106,10 @@ public class PrivateProfileContextHelperActivity extends FragmentActivity { // TODO(b/307281644) : Verify this for biometrics and check result code after new // Authentication changes are merged. if (result != null && getSystemService(KeyguardManager.class).isDeviceSecure()) { + Log.i(TAG, "separate private space lock setup success"); setResult(RESULT_OK); } else { + Log.i(TAG, "separate private space lock not setup"); setResult(RESULT_CANCELED); } finish(); diff --git a/src/com/android/settings/privatespace/PrivateProfileCreationError.java b/src/com/android/settings/privatespace/PrivateProfileCreationError.java index 74beef4efe8..bcaa1d36933 100644 --- a/src/com/android/settings/privatespace/PrivateProfileCreationError.java +++ b/src/com/android/settings/privatespace/PrivateProfileCreationError.java @@ -19,6 +19,7 @@ package com.android.settings.privatespace; import android.app.Activity; import android.app.settings.SettingsEnums; import android.os.Bundle; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -36,6 +37,8 @@ import com.google.android.setupdesign.GlifLayout; /** Fragment to display error screen if creation of private profile failed for any reason. */ public class PrivateProfileCreationError extends InstrumentedFragment { + private static final String TAG = "PrivateSpaceCreationErr"; + @Override public View onCreateView( LayoutInflater inflater, @@ -83,6 +86,7 @@ public class PrivateProfileCreationError extends InstrumentedFragment { return v -> { mMetricsFeatureProvider.action( getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_TRY_CREATE_SPACE_AGAIN); + Log.i(TAG, "Retry private space creation"); NavHostFragment.findNavController(PrivateProfileCreationError.this) .navigate(R.id.action_retry_profile_creation); }; @@ -94,6 +98,7 @@ public class PrivateProfileCreationError extends InstrumentedFragment { if (activity != null) { mMetricsFeatureProvider.action( getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_CANCEL_CREATE_SPACE); + Log.i(TAG, "private space setup cancelled"); activity.finish(); } }; diff --git a/src/com/android/settings/privatespace/PrivateSpaceAccountLoginError.java b/src/com/android/settings/privatespace/PrivateSpaceAccountLoginError.java index e445a7f54fc..b64335bdf43 100644 --- a/src/com/android/settings/privatespace/PrivateSpaceAccountLoginError.java +++ b/src/com/android/settings/privatespace/PrivateSpaceAccountLoginError.java @@ -24,6 +24,7 @@ import android.app.settings.SettingsEnums; import android.content.Intent; import android.os.Bundle; import android.os.UserHandle; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -40,14 +41,17 @@ import com.google.android.setupdesign.GlifLayout; /** Fragment to display error screen if the profile is not signed in with a Google account. */ public class PrivateSpaceAccountLoginError extends InstrumentedFragment { + private static final String TAG = "PrivateSpaceAccLoginErr"; + @Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { GlifLayout rootView = - (GlifLayout) inflater - .inflate(R.layout.privatespace_account_login_error, container, false); + (GlifLayout) + inflater.inflate( + R.layout.privatespace_account_login_error, container, false); final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class); mixin.setPrimaryButton( new FooterButton.Builder(getContext()) @@ -86,6 +90,7 @@ public class PrivateSpaceAccountLoginError extends InstrumentedFragment { && (userHandle = privateSpaceMaintainer.getPrivateProfileHandle()) != null) { Intent intent = new Intent(getContext(), PrivateProfileContextHelperActivity.class); intent.putExtra(EXTRA_ACTION_TYPE, ACCOUNT_LOGIN_ACTION); + Log.d(TAG, "Start private space activity for account login"); getActivity() .startActivityForResultAsUser(intent, ACCOUNT_LOGIN_ACTION, userHandle); } diff --git a/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java b/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java index e9cce121312..149c0d6881e 100644 --- a/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java +++ b/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java @@ -111,12 +111,14 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity { } private void promptToSetDeviceLock() { + Log.d(TAG, "Show prompt to set device lock before using private space feature"); new AlertDialog.Builder(this) .setTitle(R.string.no_device_lock_title) .setMessage(R.string.no_device_lock_summary) .setPositiveButton( R.string.no_device_lock_action_label, (DialogInterface dialog, int which) -> { + Log.d(TAG, "Start activity to set new device lock"); mSetDeviceLock.launch(new Intent(ACTION_SET_NEW_PASSWORD)); }) .setNegativeButton( @@ -176,6 +178,7 @@ public class PrivateSpaceAuthenticationActivity extends FragmentActivity { options.toBundle()) .getIntentSender()); } else { + Log.i(TAG, "Launch private space settings"); privateSpaceSettings.launch(); } finish(); diff --git a/src/com/android/settings/privatespace/PrivateSpaceEducation.java b/src/com/android/settings/privatespace/PrivateSpaceEducation.java index eb562af428c..e54982b344c 100644 --- a/src/com/android/settings/privatespace/PrivateSpaceEducation.java +++ b/src/com/android/settings/privatespace/PrivateSpaceEducation.java @@ -19,6 +19,7 @@ package com.android.settings.privatespace; import android.app.Activity; import android.app.settings.SettingsEnums; import android.os.Bundle; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -35,6 +36,7 @@ import com.google.android.setupdesign.GlifLayout; /** Fragment educating about the usage of Private Space. */ public class PrivateSpaceEducation extends InstrumentedFragment { + private static final String TAG = "PrivateSpaceEducation"; @Override public View onCreateView( @@ -77,6 +79,7 @@ public class PrivateSpaceEducation extends InstrumentedFragment { return v -> { mMetricsFeatureProvider.action( getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_START); + Log.i(TAG, "Starting private space setup"); NavHostFragment.findNavController(PrivateSpaceEducation.this) .navigate(R.id.action_education_to_auto_advance); }; @@ -88,6 +91,7 @@ public class PrivateSpaceEducation extends InstrumentedFragment { if (activity != null) { mMetricsFeatureProvider.action( getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_CANCEL); + Log.i(TAG, "private space setup cancelled"); activity.finish(); } }; diff --git a/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java b/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java index d0b79f0d07c..8d6831406f9 100644 --- a/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java +++ b/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java @@ -224,6 +224,7 @@ public class PrivateSpaceMaintainer { /** Sets the setting to show PS entry point to the provided value. */ public void setHidePrivateSpaceEntryPointSetting(int value) { + Log.d(TAG, "Setting HIDE_PRIVATE_SPACE_ENTRY_POINT = " + value); Settings.Secure.putInt(mContext.getContentResolver(), HIDE_PRIVATESPACE_ENTRY_POINT, value); } @@ -261,6 +262,7 @@ public class PrivateSpaceMaintainer { */ public synchronized boolean lockPrivateSpace() { if (isPrivateProfileRunning()) { + Log.d(TAG, "Calling requestQuietModeEnabled to enableQuietMode"); return mUserManager.requestQuietModeEnabled(true, mUserHandle); } return false; @@ -273,6 +275,7 @@ public class PrivateSpaceMaintainer { */ public synchronized void unlockPrivateSpace(IntentSender intentSender) { if (mUserHandle != null) { + Log.d(TAG, "Calling requestQuietModeEnabled to disableQuietMode"); mUserManager.requestQuietModeEnabled(false, mUserHandle, intentSender); } } @@ -297,6 +300,7 @@ public class PrivateSpaceMaintainer { */ @GuardedBy("this") private void setUserSetupComplete() { + Log.d(TAG, "setting USER_SETUP_COMPLETE = 1 for private profile"); Settings.Secure.putIntForUser(mContext.getContentResolver(), USER_SETUP_COMPLETE, 1, mUserHandle.getIdentifier()); } diff --git a/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java b/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java index 6495a4108cb..9e2e5cce03e 100644 --- a/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java +++ b/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java @@ -55,8 +55,8 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment { return null; } GlifLayout rootView = - (GlifLayout) inflater.inflate( - R.layout.privatespace_setlock_screen, container, false); + (GlifLayout) + inflater.inflate(R.layout.privatespace_setlock_screen, container, false); final FooterBarMixin mixin = rootView.getMixin(FooterBarMixin.class); mixin.setPrimaryButton( new FooterButton.Builder(getContext()) @@ -99,6 +99,7 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment { // Simply Use default screen lock. No need to handle mMetricsFeatureProvider.action( getContext(), SettingsEnums.ACTION_PRIVATE_SPACE_SETUP_ACCOUNT_LOGIN_START); + Log.d(TAG, "Use device lock for private profile"); launchActivityForAction(ACCOUNT_LOGIN_ACTION); }; } @@ -117,6 +118,7 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment { if (userHandle != null) { Intent intent = new Intent(getContext(), PrivateProfileContextHelperActivity.class); intent.putExtra(EXTRA_ACTION_TYPE, action); + Log.i(TAG, "Start separate lock setup for private profile"); getActivity().startActivityForResultAsUser(intent, action, userHandle); } else { Log.w(TAG, "Private profile user handle is null"); diff --git a/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java b/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java index da0a8052ce3..75b69cd81a0 100644 --- a/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java +++ b/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java @@ -52,8 +52,9 @@ public class PrivateSpaceSetupActivity extends FragmentActivity { super.onCreate(savedInstanceState); mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider(); setContentView(R.layout.privatespace_setup_root); - mNavHostFragment = (NavHostFragment) getSupportFragmentManager() - .findFragmentById(R.id.ps_nav_host_fragment); + mNavHostFragment = + (NavHostFragment) + getSupportFragmentManager().findFragmentById(R.id.ps_nav_host_fragment); mNavHostFragment.getNavController().setGraph(R.navigation.privatespace_main_context_nav); } diff --git a/src/com/android/settings/privatespace/SetupSuccessFragment.java b/src/com/android/settings/privatespace/SetupSuccessFragment.java index ebeae7a742d..b1e0edcc3f7 100644 --- a/src/com/android/settings/privatespace/SetupSuccessFragment.java +++ b/src/com/android/settings/privatespace/SetupSuccessFragment.java @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -100,6 +101,7 @@ public class SetupSuccessFragment extends InstrumentedFragment { } accessPrivateSpaceToast(); startActivity(allAppsIntent); + Log.i(TAG, "Private space setup complete"); activity.finish(); } };