* commit '9b52f0071780160355376484a3992d2710160a3f': Remove Binder.getOrigCallingUid().
This commit is contained in:
@@ -1052,7 +1052,7 @@ public class AccountManagerService
|
||||
if (account == null) throw new IllegalArgumentException("account is null");
|
||||
if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
|
||||
checkBinderPermission(Manifest.permission.USE_CREDENTIALS);
|
||||
UserAccounts accounts = getUserAccountsForCaller();
|
||||
final UserAccounts accounts = getUserAccountsForCaller();
|
||||
AccountAuthenticatorCache.ServiceInfo<AuthenticatorDescription> authenticatorInfo =
|
||||
mAuthenticatorCache.getServiceInfo(
|
||||
AuthenticatorDescription.newKey(account.type));
|
||||
@@ -1141,7 +1141,7 @@ public class AccountManagerService
|
||||
if (intent != null && notifyOnAuthFailure && !customTokens) {
|
||||
doNotification(mAccounts,
|
||||
account, result.getString(AccountManager.KEY_AUTH_FAILED_MESSAGE),
|
||||
intent);
|
||||
intent, accounts.userId);
|
||||
}
|
||||
}
|
||||
super.onResult(result);
|
||||
@@ -1152,7 +1152,8 @@ public class AccountManagerService
|
||||
}
|
||||
}
|
||||
|
||||
private void createNoCredentialsPermissionNotification(Account account, Intent intent) {
|
||||
private void createNoCredentialsPermissionNotification(Account account, Intent intent,
|
||||
int userId) {
|
||||
int uid = intent.getIntExtra(
|
||||
GrantCredentialsPermissionActivity.EXTRAS_REQUESTING_UID, -1);
|
||||
String authTokenType = intent.getStringExtra(
|
||||
@@ -1172,9 +1173,10 @@ public class AccountManagerService
|
||||
title = titleAndSubtitle.substring(0, index);
|
||||
subtitle = titleAndSubtitle.substring(index + 1);
|
||||
}
|
||||
n.setLatestEventInfo(mContext,
|
||||
title, subtitle,
|
||||
PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT));
|
||||
n.setLatestEventInfo(mContext, title, subtitle,
|
||||
PendingIntent.getActivityAsUser(mContext, 0, intent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT,
|
||||
null, new UserHandle(userId)));
|
||||
installNotification(getCredentialPermissionNotificationId(account, authTokenType, uid), n);
|
||||
}
|
||||
|
||||
@@ -2083,7 +2085,7 @@ public class AccountManagerService
|
||||
}
|
||||
|
||||
private void doNotification(UserAccounts accounts, Account account, CharSequence message,
|
||||
Intent intent) {
|
||||
Intent intent, int userId) {
|
||||
long identityToken = clearCallingIdentity();
|
||||
try {
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
@@ -2093,7 +2095,7 @@ public class AccountManagerService
|
||||
if (intent.getComponent() != null &&
|
||||
GrantCredentialsPermissionActivity.class.getName().equals(
|
||||
intent.getComponent().getClassName())) {
|
||||
createNoCredentialsPermissionNotification(account, intent);
|
||||
createNoCredentialsPermissionNotification(account, intent, userId);
|
||||
} else {
|
||||
final Integer notificationId = getSigninRequiredNotificationId(accounts, account);
|
||||
intent.addCategory(String.valueOf(notificationId));
|
||||
@@ -2103,8 +2105,9 @@ public class AccountManagerService
|
||||
mContext.getText(R.string.notification_title).toString();
|
||||
n.setLatestEventInfo(mContext,
|
||||
String.format(notificationTitleFormat, account.name),
|
||||
message, PendingIntent.getActivity(
|
||||
mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT));
|
||||
message, PendingIntent.getActivityAsUser(
|
||||
mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT,
|
||||
null, new UserHandle(userId)));
|
||||
installNotification(notificationId, n);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -4278,7 +4278,8 @@ public class Activity extends ContextThemeWrapper
|
||||
ActivityManagerNative.getDefault().getIntentSender(
|
||||
ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
|
||||
mParent == null ? mToken : mParent.mToken,
|
||||
mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null);
|
||||
mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null,
|
||||
UserHandle.myUserId());
|
||||
return target != null ? new PendingIntent(target) : null;
|
||||
} catch (RemoteException e) {
|
||||
// Empty
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.ConfigurationInfo;
|
||||
import android.content.pm.IPackageDataObserver;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
@@ -1225,7 +1226,7 @@ public class ActivityManager {
|
||||
public boolean clearApplicationUserData(String packageName, IPackageDataObserver observer) {
|
||||
try {
|
||||
return ActivityManagerNative.getDefault().clearApplicationUserData(packageName,
|
||||
observer, Binder.getOrigCallingUser());
|
||||
observer, UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
return false;
|
||||
}
|
||||
@@ -1902,6 +1903,31 @@ public class ActivityManager {
|
||||
return PackageManager.PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static int handleIncomingUser(int callingPid, int callingUid, int userId,
|
||||
boolean allowAll, boolean requireFull, String name, String callerPackage) {
|
||||
if (UserHandle.getUserId(callingUid) == userId) {
|
||||
return userId;
|
||||
}
|
||||
try {
|
||||
return ActivityManagerNative.getDefault().handleIncomingUser(callingPid,
|
||||
callingUid, userId, allowAll, requireFull, name, callerPackage);
|
||||
} catch (RemoteException e) {
|
||||
throw new SecurityException("Failed calling activity manager", e);
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static int getCurrentUser() {
|
||||
UserInfo ui;
|
||||
try {
|
||||
ui = ActivityManagerNative.getDefault().getCurrentUser();
|
||||
return ui != null ? ui.id : 0;
|
||||
} catch (RemoteException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the usage statistics of each installed package.
|
||||
*
|
||||
|
||||
@@ -199,8 +199,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
Configuration config = Configuration.CREATOR.createFromParcel(data);
|
||||
Bundle options = data.readInt() != 0
|
||||
? Bundle.CREATOR.createFromParcel(data) : null;
|
||||
int userId = data.readInt();
|
||||
int result = startActivityWithConfig(app, intent, resolvedType,
|
||||
resultTo, resultWho, requestCode, startFlags, config, options);
|
||||
resultTo, resultWho, requestCode, startFlags, config, options, userId);
|
||||
reply.writeNoException();
|
||||
reply.writeInt(result);
|
||||
return true;
|
||||
@@ -897,9 +898,10 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
int fl = data.readInt();
|
||||
Bundle options = data.readInt() != 0
|
||||
? Bundle.CREATOR.createFromParcel(data) : null;
|
||||
int userId = data.readInt();
|
||||
IIntentSender res = getIntentSender(type, packageName, token,
|
||||
resultWho, requestCode, requestIntents,
|
||||
requestResolvedTypes, fl, options);
|
||||
requestResolvedTypes, fl, options, userId);
|
||||
reply.writeNoException();
|
||||
reply.writeStrongBinder(res != null ? res.asBinder() : null);
|
||||
return true;
|
||||
@@ -934,6 +936,22 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
return true;
|
||||
}
|
||||
|
||||
case HANDLE_INCOMING_USER_TRANSACTION: {
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
int callingPid = data.readInt();
|
||||
int callingUid = data.readInt();
|
||||
int userId = data.readInt();
|
||||
boolean allowAll = data.readInt() != 0 ;
|
||||
boolean requireFull = data.readInt() != 0;
|
||||
String name = data.readString();
|
||||
String callerPackage = data.readString();
|
||||
int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
|
||||
requireFull, name, callerPackage);
|
||||
reply.writeNoException();
|
||||
reply.writeInt(res);
|
||||
return true;
|
||||
}
|
||||
|
||||
case SET_PROCESS_LIMIT_TRANSACTION: {
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
int max = data.readInt();
|
||||
@@ -1304,25 +1322,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
return true;
|
||||
}
|
||||
|
||||
case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
|
||||
{
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
int uid = data.readInt();
|
||||
Intent intent = Intent.CREATOR.createFromParcel(data);
|
||||
String resolvedType = data.readString();
|
||||
IBinder resultTo = data.readStrongBinder();
|
||||
String resultWho = data.readString();
|
||||
int requestCode = data.readInt();
|
||||
int startFlags = data.readInt();
|
||||
Bundle options = data.readInt() != 0
|
||||
? Bundle.CREATOR.createFromParcel(data) : null;
|
||||
int result = startActivityInPackage(uid, intent, resolvedType,
|
||||
resultTo, resultWho, requestCode, startFlags, options);
|
||||
reply.writeNoException();
|
||||
reply.writeInt(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
case KILL_APPLICATION_WITH_UID_TRANSACTION: {
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
String pkg = data.readString();
|
||||
@@ -1489,22 +1488,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
|
||||
return true;
|
||||
}
|
||||
|
||||
case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
|
||||
{
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
int uid = data.readInt();
|
||||
Intent[] intents = data.createTypedArray(Intent.CREATOR);
|
||||
String[] resolvedTypes = data.createStringArray();
|
||||
IBinder resultTo = data.readStrongBinder();
|
||||
Bundle options = data.readInt() != 0
|
||||
? Bundle.CREATOR.createFromParcel(data) : null;
|
||||
int result = startActivitiesInPackage(uid, intents, resolvedTypes,
|
||||
resultTo, options);
|
||||
reply.writeNoException();
|
||||
reply.writeInt(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
case START_ACTIVITIES_TRANSACTION:
|
||||
{
|
||||
data.enforceInterface(IActivityManager.descriptor);
|
||||
@@ -1877,7 +1860,7 @@ class ActivityManagerProxy implements IActivityManager
|
||||
public int startActivityWithConfig(IApplicationThread caller, Intent intent,
|
||||
String resolvedType, IBinder resultTo, String resultWho,
|
||||
int requestCode, int startFlags, Configuration config,
|
||||
Bundle options) throws RemoteException {
|
||||
Bundle options, int userId) throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
data.writeInterfaceToken(IActivityManager.descriptor);
|
||||
@@ -1895,6 +1878,7 @@ class ActivityManagerProxy implements IActivityManager
|
||||
} else {
|
||||
data.writeInt(0);
|
||||
}
|
||||
data.writeInt(userId);
|
||||
mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
|
||||
reply.readException();
|
||||
int result = reply.readInt();
|
||||
@@ -2840,7 +2824,7 @@ class ActivityManagerProxy implements IActivityManager
|
||||
public IIntentSender getIntentSender(int type,
|
||||
String packageName, IBinder token, String resultWho,
|
||||
int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
|
||||
Bundle options) throws RemoteException {
|
||||
Bundle options, int userId) throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
data.writeInterfaceToken(IActivityManager.descriptor);
|
||||
@@ -2863,6 +2847,7 @@ class ActivityManagerProxy implements IActivityManager
|
||||
} else {
|
||||
data.writeInt(0);
|
||||
}
|
||||
data.writeInt(userId);
|
||||
mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
|
||||
reply.readException();
|
||||
IIntentSender res = IIntentSender.Stub.asInterface(
|
||||
@@ -2905,6 +2890,25 @@ class ActivityManagerProxy implements IActivityManager
|
||||
reply.recycle();
|
||||
return res;
|
||||
}
|
||||
public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
|
||||
boolean requireFull, String name, String callerPackage) throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
data.writeInterfaceToken(IActivityManager.descriptor);
|
||||
data.writeInt(callingPid);
|
||||
data.writeInt(callingUid);
|
||||
data.writeInt(userId);
|
||||
data.writeInt(allowAll ? 1 : 0);
|
||||
data.writeInt(requireFull ? 1 : 0);
|
||||
data.writeString(name);
|
||||
data.writeString(callerPackage);
|
||||
mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
|
||||
reply.readException();
|
||||
int res = reply.readInt();
|
||||
data.recycle();
|
||||
reply.recycle();
|
||||
return res;
|
||||
}
|
||||
public void setProcessLimit(int max) throws RemoteException
|
||||
{
|
||||
Parcel data = Parcel.obtain();
|
||||
@@ -3360,34 +3364,6 @@ class ActivityManagerProxy implements IActivityManager
|
||||
data.recycle();
|
||||
}
|
||||
|
||||
public int startActivityInPackage(int uid,
|
||||
Intent intent, String resolvedType, IBinder resultTo,
|
||||
String resultWho, int requestCode, int startFlags, Bundle options)
|
||||
throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
data.writeInterfaceToken(IActivityManager.descriptor);
|
||||
data.writeInt(uid);
|
||||
intent.writeToParcel(data, 0);
|
||||
data.writeString(resolvedType);
|
||||
data.writeStrongBinder(resultTo);
|
||||
data.writeString(resultWho);
|
||||
data.writeInt(requestCode);
|
||||
data.writeInt(startFlags);
|
||||
if (options != null) {
|
||||
data.writeInt(1);
|
||||
options.writeToParcel(data, 0);
|
||||
} else {
|
||||
data.writeInt(0);
|
||||
}
|
||||
mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
|
||||
reply.readException();
|
||||
int result = reply.readInt();
|
||||
reply.recycle();
|
||||
data.recycle();
|
||||
return result;
|
||||
}
|
||||
|
||||
public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
@@ -3655,30 +3631,6 @@ class ActivityManagerProxy implements IActivityManager
|
||||
return result;
|
||||
}
|
||||
|
||||
public int startActivitiesInPackage(int uid,
|
||||
Intent[] intents, String[] resolvedTypes, IBinder resultTo,
|
||||
Bundle options) throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
data.writeInterfaceToken(IActivityManager.descriptor);
|
||||
data.writeInt(uid);
|
||||
data.writeTypedArray(intents, 0);
|
||||
data.writeStringArray(resolvedTypes);
|
||||
data.writeStrongBinder(resultTo);
|
||||
if (options != null) {
|
||||
data.writeInt(1);
|
||||
options.writeToParcel(data, 0);
|
||||
} else {
|
||||
data.writeInt(0);
|
||||
}
|
||||
mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
|
||||
reply.readException();
|
||||
int result = reply.readInt();
|
||||
reply.recycle();
|
||||
data.recycle();
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getFrontActivityScreenCompatMode() throws RemoteException {
|
||||
Parcel data = Parcel.obtain();
|
||||
Parcel reply = Parcel.obtain();
|
||||
|
||||
@@ -1000,7 +1000,7 @@ class ContextImpl extends Context {
|
||||
ActivityManagerNative.getDefault().broadcastIntent(
|
||||
mMainThread.getApplicationThread(), intent, resolvedType, null,
|
||||
Activity.RESULT_OK, null, null, null, false, false,
|
||||
Binder.getOrigCallingUser());
|
||||
UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@ class ContextImpl extends Context {
|
||||
ActivityManagerNative.getDefault().broadcastIntent(
|
||||
mMainThread.getApplicationThread(), intent, resolvedType, null,
|
||||
Activity.RESULT_OK, null, null, receiverPermission, false, false,
|
||||
Binder.getOrigCallingUser());
|
||||
UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -1027,7 +1027,7 @@ class ContextImpl extends Context {
|
||||
ActivityManagerNative.getDefault().broadcastIntent(
|
||||
mMainThread.getApplicationThread(), intent, resolvedType, null,
|
||||
Activity.RESULT_OK, null, null, receiverPermission, true, false,
|
||||
Binder.getOrigCallingUser());
|
||||
UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -1060,7 +1060,7 @@ class ContextImpl extends Context {
|
||||
ActivityManagerNative.getDefault().broadcastIntent(
|
||||
mMainThread.getApplicationThread(), intent, resolvedType, rd,
|
||||
initialCode, initialData, initialExtras, receiverPermission,
|
||||
true, false, Binder.getOrigCallingUser());
|
||||
true, false, UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ class ContextImpl extends Context {
|
||||
ActivityManagerNative.getDefault().broadcastIntent(
|
||||
mMainThread.getApplicationThread(), intent, resolvedType, null,
|
||||
Activity.RESULT_OK, null, null, null, false, true,
|
||||
Binder.getOrigCallingUser());
|
||||
UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ class ContextImpl extends Context {
|
||||
ActivityManagerNative.getDefault().broadcastIntent(
|
||||
mMainThread.getApplicationThread(), intent, resolvedType, rd,
|
||||
initialCode, initialData, initialExtras, null,
|
||||
true, true, Binder.getOrigCallingUser());
|
||||
true, true, UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -1179,7 +1179,7 @@ class ContextImpl extends Context {
|
||||
try {
|
||||
intent.setAllowFds(false);
|
||||
ActivityManagerNative.getDefault().unbroadcastIntent(
|
||||
mMainThread.getApplicationThread(), intent, Binder.getOrigCallingUser());
|
||||
mMainThread.getApplicationThread(), intent, UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public interface IActivityManager extends IInterface {
|
||||
public int startActivityWithConfig(IApplicationThread caller,
|
||||
Intent intent, String resolvedType, IBinder resultTo, String resultWho,
|
||||
int requestCode, int startFlags, Configuration newConfig,
|
||||
Bundle options) throws RemoteException;
|
||||
Bundle options, int userId) throws RemoteException;
|
||||
public int startActivityIntentSender(IApplicationThread caller,
|
||||
IntentSender intent, Intent fillInIntent, String resolvedType,
|
||||
IBinder resultTo, String resultWho, int requestCode,
|
||||
@@ -177,13 +177,16 @@ public interface IActivityManager extends IInterface {
|
||||
public IIntentSender getIntentSender(int type,
|
||||
String packageName, IBinder token, String resultWho,
|
||||
int requestCode, Intent[] intents, String[] resolvedTypes,
|
||||
int flags, Bundle options) throws RemoteException;
|
||||
int flags, Bundle options, int userId) throws RemoteException;
|
||||
public void cancelIntentSender(IIntentSender sender) throws RemoteException;
|
||||
public boolean clearApplicationUserData(final String packageName,
|
||||
final IPackageDataObserver observer, int userId) throws RemoteException;
|
||||
public String getPackageForIntentSender(IIntentSender sender) throws RemoteException;
|
||||
public int getUidForIntentSender(IIntentSender sender) throws RemoteException;
|
||||
|
||||
public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
|
||||
boolean requireFull, String name, String callerPackage) throws RemoteException;
|
||||
|
||||
public void setProcessLimit(int max) throws RemoteException;
|
||||
public int getProcessLimit() throws RemoteException;
|
||||
|
||||
@@ -272,11 +275,6 @@ public interface IActivityManager extends IInterface {
|
||||
public void stopAppSwitches() throws RemoteException;
|
||||
public void resumeAppSwitches() throws RemoteException;
|
||||
|
||||
public int startActivityInPackage(int uid,
|
||||
Intent intent, String resolvedType, IBinder resultTo,
|
||||
String resultWho, int requestCode, int startFlags, Bundle options)
|
||||
throws RemoteException;
|
||||
|
||||
public void killApplicationWithUid(String pkg, int uid) throws RemoteException;
|
||||
|
||||
public void closeSystemDialogs(String reason) throws RemoteException;
|
||||
@@ -316,9 +314,6 @@ public interface IActivityManager extends IInterface {
|
||||
public int startActivities(IApplicationThread caller,
|
||||
Intent[] intents, String[] resolvedTypes, IBinder resultTo,
|
||||
Bundle options) throws RemoteException;
|
||||
public int startActivitiesInPackage(int uid,
|
||||
Intent[] intents, String[] resolvedTypes, IBinder resultTo,
|
||||
Bundle options) throws RemoteException;
|
||||
|
||||
public int getFrontActivityScreenCompatMode() throws RemoteException;
|
||||
public void setFrontActivityScreenCompatMode(int mode) throws RemoteException;
|
||||
@@ -551,9 +546,8 @@ public interface IActivityManager extends IInterface {
|
||||
int BACKUP_AGENT_CREATED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+90;
|
||||
int UNBIND_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+91;
|
||||
int GET_UID_FOR_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+92;
|
||||
int HANDLE_INCOMING_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+93;
|
||||
|
||||
|
||||
int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94;
|
||||
int KILL_APPLICATION_WITH_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95;
|
||||
int CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96;
|
||||
int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97;
|
||||
@@ -580,7 +574,7 @@ public interface IActivityManager extends IInterface {
|
||||
int CHECK_GRANT_URI_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+118;
|
||||
int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+119;
|
||||
int START_ACTIVITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+120;
|
||||
int START_ACTIVITIES_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+121;
|
||||
|
||||
int ACTIVITY_SLEPT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+122;
|
||||
int GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+123;
|
||||
int SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+124;
|
||||
|
||||
@@ -24,16 +24,13 @@ import android.content.Intent;
|
||||
/** {@hide} */
|
||||
interface INotificationManager
|
||||
{
|
||||
/** @deprecated use {@link #enqueueNotificationWithTag} instead */
|
||||
void enqueueNotification(String pkg, int id, in Notification notification, inout int[] idReceived);
|
||||
/** @deprecated use {@link #cancelNotificationWithTag} instead */
|
||||
void cancelNotification(String pkg, int id);
|
||||
void cancelAllNotifications(String pkg);
|
||||
void cancelAllNotifications(String pkg, int userId);
|
||||
|
||||
void enqueueToast(String pkg, ITransientNotification callback, int duration);
|
||||
void cancelToast(String pkg, ITransientNotification callback);
|
||||
void enqueueNotificationWithTag(String pkg, String tag, int id, in Notification notification, inout int[] idReceived);
|
||||
void cancelNotificationWithTag(String pkg, String tag, int id);
|
||||
void enqueueNotificationWithTag(String pkg, String tag, int id,
|
||||
in Notification notification, inout int[] idReceived, int userId);
|
||||
void cancelNotificationWithTag(String pkg, String tag, int id, int userId);
|
||||
|
||||
void setNotificationsEnabledForPackage(String pkg, boolean enabled);
|
||||
boolean areNotificationsEnabledForPackage(String pkg);
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
@@ -125,7 +126,27 @@ public class NotificationManager
|
||||
String pkg = mContext.getPackageName();
|
||||
if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
|
||||
try {
|
||||
service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut);
|
||||
service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut,
|
||||
UserHandle.myUserId());
|
||||
if (id != idOut[0]) {
|
||||
Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void notifyAsUser(String tag, int id, Notification notification, UserHandle user)
|
||||
{
|
||||
int[] idOut = new int[1];
|
||||
INotificationManager service = getService();
|
||||
String pkg = mContext.getPackageName();
|
||||
if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
|
||||
try {
|
||||
service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut,
|
||||
user.getIdentifier());
|
||||
if (id != idOut[0]) {
|
||||
Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
|
||||
}
|
||||
@@ -154,7 +175,21 @@ public class NotificationManager
|
||||
String pkg = mContext.getPackageName();
|
||||
if (localLOGV) Log.v(TAG, pkg + ": cancel(" + id + ")");
|
||||
try {
|
||||
service.cancelNotificationWithTag(pkg, tag, id);
|
||||
service.cancelNotificationWithTag(pkg, tag, id, UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void cancelAsUser(String tag, int id, UserHandle user)
|
||||
{
|
||||
INotificationManager service = getService();
|
||||
String pkg = mContext.getPackageName();
|
||||
if (localLOGV) Log.v(TAG, pkg + ": cancel(" + id + ")");
|
||||
try {
|
||||
service.cancelNotificationWithTag(pkg, tag, id, user.getIdentifier());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
@@ -169,7 +204,7 @@ public class NotificationManager
|
||||
String pkg = mContext.getPackageName();
|
||||
if (localLOGV) Log.v(TAG, pkg + ": cancelAll()");
|
||||
try {
|
||||
service.cancelAllNotifications(pkg);
|
||||
service.cancelAllNotifications(pkg, UserHandle.myUserId());
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,29 @@ public final class PendingIntent implements Parcelable {
|
||||
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
|
||||
null, null, requestCode, new Intent[] { intent },
|
||||
resolvedType != null ? new String[] { resolvedType } : null,
|
||||
flags, options);
|
||||
flags, options, UserHandle.myUserId());
|
||||
return target != null ? new PendingIntent(target) : null;
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static PendingIntent getActivityAsUser(Context context, int requestCode,
|
||||
Intent intent, int flags, Bundle options, UserHandle user) {
|
||||
String packageName = context.getPackageName();
|
||||
String resolvedType = intent != null ? intent.resolveTypeIfNeeded(
|
||||
context.getContentResolver()) : null;
|
||||
try {
|
||||
intent.setAllowFds(false);
|
||||
IIntentSender target =
|
||||
ActivityManagerNative.getDefault().getIntentSender(
|
||||
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
|
||||
null, null, requestCode, new Intent[] { intent },
|
||||
resolvedType != null ? new String[] { resolvedType } : null,
|
||||
flags, options, user.getIdentifier());
|
||||
return target != null ? new PendingIntent(target) : null;
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -334,7 +356,8 @@ public final class PendingIntent implements Parcelable {
|
||||
IIntentSender target =
|
||||
ActivityManagerNative.getDefault().getIntentSender(
|
||||
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
|
||||
null, null, requestCode, intents, resolvedTypes, flags, options);
|
||||
null, null, requestCode, intents, resolvedTypes, flags, options,
|
||||
UserHandle.myUserId());
|
||||
return target != null ? new PendingIntent(target) : null;
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -372,7 +395,7 @@ public final class PendingIntent implements Parcelable {
|
||||
ActivityManager.INTENT_SENDER_BROADCAST, packageName,
|
||||
null, null, requestCode, new Intent[] { intent },
|
||||
resolvedType != null ? new String[] { resolvedType } : null,
|
||||
flags, null);
|
||||
flags, null, UserHandle.myUserId());
|
||||
return target != null ? new PendingIntent(target) : null;
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
@@ -411,7 +434,7 @@ public final class PendingIntent implements Parcelable {
|
||||
ActivityManager.INTENT_SENDER_SERVICE, packageName,
|
||||
null, null, requestCode, new Intent[] { intent },
|
||||
resolvedType != null ? new String[] { resolvedType } : null,
|
||||
flags, null);
|
||||
flags, null, UserHandle.myUserId());
|
||||
return target != null ? new PendingIntent(target) : null;
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
|
||||
@@ -980,7 +980,7 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
mSyncHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
boolean bindToSyncAdapter(RegisteredServicesCache.ServiceInfo info) {
|
||||
boolean bindToSyncAdapter(RegisteredServicesCache.ServiceInfo info, int userId) {
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
Log.d(TAG, "bindToSyncAdapter: " + info.componentName + ", connection " + this);
|
||||
}
|
||||
@@ -989,8 +989,9 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
intent.setComponent(info.componentName);
|
||||
intent.putExtra(Intent.EXTRA_CLIENT_LABEL,
|
||||
com.android.internal.R.string.sync_binding_label);
|
||||
intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity(
|
||||
mContext, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0));
|
||||
intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivityAsUser(
|
||||
mContext, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0,
|
||||
null, new UserHandle(userId)));
|
||||
mBound = true;
|
||||
final boolean bindResult = mContext.bindService(intent, this,
|
||||
Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND
|
||||
@@ -2132,7 +2133,7 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
Log.v(TAG, "dispatchSyncOperation: starting " + activeSyncContext);
|
||||
}
|
||||
if (!activeSyncContext.bindToSyncAdapter(syncAdapterInfo)) {
|
||||
if (!activeSyncContext.bindToSyncAdapter(syncAdapterInfo, op.userId)) {
|
||||
Log.e(TAG, "Bind attempt failed to " + syncAdapterInfo);
|
||||
closeActiveSyncContext(activeSyncContext);
|
||||
return false;
|
||||
@@ -2255,10 +2256,12 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
|
||||
if (syncResult != null && syncResult.tooManyDeletions) {
|
||||
installHandleTooManyDeletesNotification(syncOperation.account,
|
||||
syncOperation.authority, syncResult.stats.numDeletes);
|
||||
syncOperation.authority, syncResult.stats.numDeletes,
|
||||
syncOperation.userId);
|
||||
} else {
|
||||
mNotificationMgr.cancel(
|
||||
syncOperation.account.hashCode() ^ syncOperation.authority.hashCode());
|
||||
mNotificationMgr.cancelAsUser(null,
|
||||
syncOperation.account.hashCode() ^ syncOperation.authority.hashCode(),
|
||||
new UserHandle(syncOperation.userId));
|
||||
}
|
||||
|
||||
if (syncResult != null && syncResult.fullSyncRequested) {
|
||||
@@ -2471,7 +2474,7 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
}
|
||||
|
||||
private void installHandleTooManyDeletesNotification(Account account, String authority,
|
||||
long numDeletes) {
|
||||
long numDeletes, int userId) {
|
||||
if (mNotificationMgr == null) return;
|
||||
|
||||
final ProviderInfo providerInfo = mContext.getPackageManager().resolveContentProvider(
|
||||
@@ -2493,7 +2496,8 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
}
|
||||
|
||||
final PendingIntent pendingIntent = PendingIntent
|
||||
.getActivity(mContext, 0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
.getActivityAsUser(mContext, 0, clickIntent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT, null, new UserHandle(userId));
|
||||
|
||||
CharSequence tooManyDeletesDescFormat = mContext.getResources().getText(
|
||||
R.string.contentServiceTooManyDeletesNotificationDesc);
|
||||
@@ -2507,7 +2511,8 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
String.format(tooManyDeletesDescFormat.toString(), authorityName),
|
||||
pendingIntent);
|
||||
notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
mNotificationMgr.notify(account.hashCode() ^ authority.hashCode(), notification);
|
||||
mNotificationMgr.notifyAsUser(null, account.hashCode() ^ authority.hashCode(),
|
||||
notification, new UserHandle(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,34 +72,6 @@ public class Binder implements IBinder {
|
||||
*/
|
||||
public static final native int getCallingUid();
|
||||
|
||||
/**
|
||||
* Return the original ID of the user assigned to the process that sent you the current
|
||||
* transaction that is being processed. This uid can be used with higher-level system services
|
||||
* to determine its identity and check permissions. If the current thread is not currently
|
||||
* executing an incoming transaction, then its own uid is returned.
|
||||
* <p/>
|
||||
* This value cannot be reset by calls to {@link #clearCallingIdentity()}.
|
||||
* @hide
|
||||
*/
|
||||
public static final int getOrigCallingUid() {
|
||||
if (UserHandle.MU_ENABLED) {
|
||||
return getOrigCallingUidNative();
|
||||
} else {
|
||||
return getCallingUid();
|
||||
}
|
||||
}
|
||||
|
||||
private static final native int getOrigCallingUidNative();
|
||||
|
||||
/**
|
||||
* Utility function to return the user id of the calling process.
|
||||
* @return userId of the calling process, extracted from the callingUid
|
||||
* @hide
|
||||
*/
|
||||
public static final int getOrigCallingUser() {
|
||||
return UserHandle.getUserId(getOrigCallingUid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the identity of the incoming IPC on the current thread. This can
|
||||
* be useful if, while handling an incoming call, you will be calling
|
||||
|
||||
Reference in New Issue
Block a user