Merge "Change ownership of the account request notification." into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
aaccd1b152
@@ -3376,6 +3376,8 @@
|
|||||||
<string name="deny">Deny</string>
|
<string name="deny">Deny</string>
|
||||||
<string name="permission_request_notification_title">Permission requested</string>
|
<string name="permission_request_notification_title">Permission requested</string>
|
||||||
<string name="permission_request_notification_with_subtitle">Permission requested\nfor account <xliff:g id="account" example="foo@gmail.com">%s</xliff:g>.</string>
|
<string name="permission_request_notification_with_subtitle">Permission requested\nfor account <xliff:g id="account" example="foo@gmail.com">%s</xliff:g>.</string>
|
||||||
|
<!-- Title and subtitle for notification shown when app request account access (two lines) [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="permission_request_notification_for_app_with_subtitle">Permission requested by <xliff:g id="app" example="Gmail">%1$s</xliff:g>\nfor account <xliff:g id="account" example="foo@gmail.com">%2$s</xliff:g>.</string>
|
||||||
|
|
||||||
<!-- Message to show when an intent automatically switches users into the personal profile. -->
|
<!-- Message to show when an intent automatically switches users into the personal profile. -->
|
||||||
<string name="forward_intent_to_owner">You\'re using this app outside of your work profile</string>
|
<string name="forward_intent_to_owner">You\'re using this app outside of your work profile</string>
|
||||||
|
|||||||
@@ -506,6 +506,7 @@
|
|||||||
<java-symbol type="string" name="menu_space_shortcut_label" />
|
<java-symbol type="string" name="menu_space_shortcut_label" />
|
||||||
<java-symbol type="string" name="notification_title" />
|
<java-symbol type="string" name="notification_title" />
|
||||||
<java-symbol type="string" name="permission_request_notification_with_subtitle" />
|
<java-symbol type="string" name="permission_request_notification_with_subtitle" />
|
||||||
|
<java-symbol type="string" name="permission_request_notification_for_app_with_subtitle" />
|
||||||
<java-symbol type="string" name="prepend_shortcut_label" />
|
<java-symbol type="string" name="prepend_shortcut_label" />
|
||||||
<java-symbol type="string" name="paste_as_plain_text" />
|
<java-symbol type="string" name="paste_as_plain_text" />
|
||||||
<java-symbol type="string" name="replace" />
|
<java-symbol type="string" name="replace" />
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ public class AccountManagerService
|
|||||||
if (!checkAccess || hasAccountAccess(account, packageName,
|
if (!checkAccess || hasAccountAccess(account, packageName,
|
||||||
UserHandle.getUserHandleForUid(uid))) {
|
UserHandle.getUserHandleForUid(uid))) {
|
||||||
cancelNotification(getCredentialPermissionNotificationId(account,
|
cancelNotification(getCredentialPermissionNotificationId(account,
|
||||||
AccountManager.ACCOUNT_ACCESS_TOKEN_TYPE, uid), packageName,
|
AccountManager.ACCOUNT_ACCESS_TOKEN_TYPE, uid),
|
||||||
UserHandle.getUserHandleForUid(uid));
|
UserHandle.getUserHandleForUid(uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3013,8 +3013,8 @@ public class AccountManagerService
|
|||||||
String authTokenType = intent.getStringExtra(
|
String authTokenType = intent.getStringExtra(
|
||||||
GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_TYPE);
|
GrantCredentialsPermissionActivity.EXTRAS_AUTH_TOKEN_TYPE);
|
||||||
final String titleAndSubtitle =
|
final String titleAndSubtitle =
|
||||||
mContext.getString(R.string.permission_request_notification_with_subtitle,
|
mContext.getString(R.string.permission_request_notification_for_app_with_subtitle,
|
||||||
account.name);
|
getApplicationLabel(packageName), account.name);
|
||||||
final int index = titleAndSubtitle.indexOf('\n');
|
final int index = titleAndSubtitle.indexOf('\n');
|
||||||
String title = titleAndSubtitle;
|
String title = titleAndSubtitle;
|
||||||
String subtitle = "";
|
String subtitle = "";
|
||||||
@@ -3036,7 +3036,16 @@ public class AccountManagerService
|
|||||||
PendingIntent.FLAG_CANCEL_CURRENT, null, user))
|
PendingIntent.FLAG_CANCEL_CURRENT, null, user))
|
||||||
.build();
|
.build();
|
||||||
installNotification(getCredentialPermissionNotificationId(
|
installNotification(getCredentialPermissionNotificationId(
|
||||||
account, authTokenType, uid), n, packageName, user.getIdentifier());
|
account, authTokenType, uid), n, "android", user.getIdentifier());
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getApplicationLabel(String packageName) {
|
||||||
|
try {
|
||||||
|
return mPackageManager.getApplicationLabel(
|
||||||
|
mPackageManager.getApplicationInfo(packageName, 0)).toString();
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Intent newGrantCredentialsPermissionIntent(Account account, String packageName,
|
private Intent newGrantCredentialsPermissionIntent(Account account, String packageName,
|
||||||
@@ -3072,7 +3081,7 @@ public class AccountManagerService
|
|||||||
nId = accounts.credentialsPermissionNotificationIds.get(key);
|
nId = accounts.credentialsPermissionNotificationIds.get(key);
|
||||||
if (nId == null) {
|
if (nId == null) {
|
||||||
String tag = TAG + ":" + SystemMessage.NOTE_ACCOUNT_CREDENTIAL_PERMISSION
|
String tag = TAG + ":" + SystemMessage.NOTE_ACCOUNT_CREDENTIAL_PERMISSION
|
||||||
+ ":" + account.hashCode() + ":" + authTokenType.hashCode();
|
+ ":" + account.hashCode() + ":" + authTokenType.hashCode() + ":" + uid;
|
||||||
int id = SystemMessage.NOTE_ACCOUNT_CREDENTIAL_PERMISSION;
|
int id = SystemMessage.NOTE_ACCOUNT_CREDENTIAL_PERMISSION;
|
||||||
nId = new NotificationId(tag, id);
|
nId = new NotificationId(tag, id);
|
||||||
accounts.credentialsPermissionNotificationIds.put(key, nId);
|
accounts.credentialsPermissionNotificationIds.put(key, nId);
|
||||||
@@ -4021,7 +4030,7 @@ public class AccountManagerService
|
|||||||
|
|
||||||
private void handleAuthenticatorResponse(boolean accessGranted) throws RemoteException {
|
private void handleAuthenticatorResponse(boolean accessGranted) throws RemoteException {
|
||||||
cancelNotification(getCredentialPermissionNotificationId(account,
|
cancelNotification(getCredentialPermissionNotificationId(account,
|
||||||
AccountManager.ACCOUNT_ACCESS_TOKEN_TYPE, uid), packageName,
|
AccountManager.ACCOUNT_ACCESS_TOKEN_TYPE, uid),
|
||||||
UserHandle.getUserHandleForUid(uid));
|
UserHandle.getUserHandleForUid(uid));
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
Bundle result = new Bundle();
|
Bundle result = new Bundle();
|
||||||
|
|||||||
Reference in New Issue
Block a user