Show the current user in power menu
Shows a little indicator next to the current user in the power menu
when multi-user is enabled.
Fixed a bug where Settings was sometimes being launched in the wrong
process when there are 2 instances running.
Change-Id: Iaf2a00f6d1871fd2a88d8982439e445423bb2896
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index c402329..5917cbf 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -25,6 +25,7 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.ConfigurationInfo;
import android.content.pm.IPackageDataObserver;
+import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.Uri;
@@ -1494,7 +1495,15 @@
reply.writeInt(result ? 1 : 0);
return true;
}
-
+
+ case GET_CURRENT_USER_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ UserInfo userInfo = getCurrentUser();
+ reply.writeNoException();
+ userInfo.writeToParcel(reply, 0);
+ return true;
+ }
+
case REMOVE_SUB_TASK_TRANSACTION:
{
data.enforceInterface(IActivityManager.descriptor);
@@ -3530,7 +3539,19 @@
data.recycle();
return result;
}
-
+
+ public UserInfo getCurrentUser() throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
+ reply.readException();
+ UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
+ reply.recycle();
+ data.recycle();
+ return userInfo;
+ }
+
public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();