Add current user handle to tile intent in account detail page.
- the account detail settings page is launched with the correct user handle when there is work profile to indicate which profile the account belongs to. When we process the dynamic tile, for the page, we should add this info to the tile intent, so that it can be launched with the correct profile. - when we launch the tile intent, check whether there's user handle specified. If so, launch the intent directly without prompting for profile selection. Change-Id: I91f8c666a826909006b1f53907b3441825322c10 Fixes: 119657694 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package com.android.settings.accounts;
|
||||
|
||||
import static android.content.Intent.EXTRA_USER;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -56,6 +59,8 @@ public class AccountDetailDashboardFragment extends DashboardFragment {
|
||||
String mAccountType;
|
||||
private AccountSyncPreferenceController mAccountSynController;
|
||||
private RemoveAccountPreferenceController mRemoveAccountController;
|
||||
@VisibleForTesting
|
||||
UserHandle mUserHandle;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -63,7 +68,7 @@ public class AccountDetailDashboardFragment extends DashboardFragment {
|
||||
getPreferenceManager().setPreferenceComparisonCallback(null);
|
||||
Bundle args = getArguments();
|
||||
final Activity activity = getActivity();
|
||||
UserHandle userHandle = Utils.getSecureTargetUser(activity.getActivityToken(),
|
||||
mUserHandle = Utils.getSecureTargetUser(activity.getActivityToken(),
|
||||
(UserManager) getSystemService(Context.USER_SERVICE), args,
|
||||
activity.getIntent().getExtras());
|
||||
if (args != null) {
|
||||
@@ -77,8 +82,8 @@ public class AccountDetailDashboardFragment extends DashboardFragment {
|
||||
mAccountType = args.getString(KEY_ACCOUNT_TYPE);
|
||||
}
|
||||
}
|
||||
mAccountSynController.init(mAccount, userHandle);
|
||||
mRemoveAccountController.init(mAccount, userHandle);
|
||||
mAccountSynController.init(mAccount, mUserHandle);
|
||||
mRemoveAccountController.init(mAccount, mUserHandle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,7 +159,9 @@ public class AccountDetailDashboardFragment extends DashboardFragment {
|
||||
}
|
||||
final boolean display = mAccountType.equals(metadata.getString(METADATA_IA_ACCOUNT));
|
||||
if (display) {
|
||||
tile.getIntent().putExtra(EXTRA_ACCOUNT_NAME, mAccount.name);
|
||||
final Intent intent = tile.getIntent();
|
||||
intent.putExtra(EXTRA_ACCOUNT_NAME, mAccount.name);
|
||||
intent.putExtra(EXTRA_USER, mUserHandle);
|
||||
}
|
||||
return display;
|
||||
}
|
||||
|
Reference in New Issue
Block a user