Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9ae5f75 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 23307cbb: am e0a676a3: Merge "Fix issue #7649590: Background windows...

am 23307cbb: am e0a676a3: Merge "Fix issue #7649590: Background windows sometimes not being hidden for secondary users" into jb-mr1.1-dev

* commit '23307cbb':
  Fix issue #7649590: Background windows sometimes not being hidden for secondary users
parents dac257cd 23307cbb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ interface IWindowManager
    void setEventDispatching(boolean enabled);
    void addWindowToken(IBinder token, int type);
    void removeWindowToken(IBinder token);
    void addAppToken(int addPos, IApplicationToken token,
    void addAppToken(int addPos, int userId, IApplicationToken token,
            int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
    void setAppGroupId(IBinder token, int groupId);
    void setAppOrientation(IApplicationToken token, int requestedOrientation);
+33 −18
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.os.UserHandle;
import android.util.SparseArray;

import java.util.HashMap;
@@ -36,8 +37,8 @@ public final class AttributeCache {
    private static AttributeCache sInstance = null;

    private final Context mContext;
    private final WeakHashMap<String, Package> mPackages =
            new WeakHashMap<String, Package>();
    private final SparseArray<WeakHashMap<String, Package>> mPackages =
            new SparseArray<WeakHashMap<String, Package>>();
    private final Configuration mConfiguration = new Configuration();

    public final static class Package {
@@ -76,7 +77,9 @@ public final class AttributeCache {

    public void removePackage(String packageName) {
        synchronized (this) {
            mPackages.remove(packageName);
            for (int i=0; i<mPackages.size(); i++) {
                mPackages.valueAt(i).remove(packageName);
            }
        }
    }

@@ -94,9 +97,20 @@ public final class AttributeCache {
        }
    }

    public Entry get(String packageName, int resId, int[] styleable) {
    public void removeUser(int userId) {
        synchronized (this) {
            mPackages.remove(userId);
        }
    }

    public Entry get(int userId, String packageName, int resId, int[] styleable) {
        synchronized (this) {
            Package pkg = mPackages.get(packageName);
            WeakHashMap<String, Package> packages = mPackages.get(userId);
            if (packages == null) {
                packages = new WeakHashMap<String, Package>();
                mPackages.put(userId, packages);
            }
            Package pkg = packages.get(packageName);
            HashMap<int[], Entry> map = null;
            Entry ent = null;
            if (pkg != null) {
@@ -110,7 +124,8 @@ public final class AttributeCache {
            } else {
                Context context;
                try {
                    context = mContext.createPackageContext(packageName, 0);
                    context = mContext.createPackageContextAsUser(packageName, 0,
                            new UserHandle(userId));
                    if (context == null) {
                        return null;
                    }
@@ -118,7 +133,7 @@ public final class AttributeCache {
                    return null;
                }
                pkg = new Package(context);
                mPackages.put(packageName, pkg);
                packages.put(packageName, pkg);
            }
            
            if (map == null) {
+4 −0
Original line number Diff line number Diff line
@@ -14551,6 +14551,10 @@ public final class ActivityManagerService extends ActivityManagerNative
                // Clean up all state and processes associated with the user.
                // Kill all the processes for the user.
                forceStopUserLocked(userId);
                AttributeCache ac = AttributeCache.instance();
                if (ac != null) {
                    ac.removeUser(userId);
                }
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ final class ActivityRecord {
            packageName = aInfo.applicationInfo.packageName;
            launchMode = aInfo.launchMode;
            
            AttributeCache.Entry ent = AttributeCache.instance().get(packageName,
            AttributeCache.Entry ent = AttributeCache.instance().get(userId, packageName,
                    realTheme, com.android.internal.R.styleable.Window);
            fullscreen = ent != null && !ent.array.getBoolean(
                    com.android.internal.R.styleable.Window_windowIsFloating, false)
+6 −6
Original line number Diff line number Diff line
@@ -1810,8 +1810,8 @@ final class ActivityStack {
                        }
                        mHistory.add(addPos, r);
                        r.putInHistory();
                        mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId,
                                r.info.screenOrientation, r.fullscreen,
                        mService.mWindowManager.addAppToken(addPos, r.userId, r.appToken,
                                r.task.taskId, r.info.screenOrientation, r.fullscreen,
                                (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0);
                        if (VALIDATE_TOKENS) {
                            validateAppTokensLocked();
@@ -1875,8 +1875,8 @@ final class ActivityStack {
                mNoAnimActivities.remove(r);
            }
            r.updateOptionsLocked(options);
            mService.mWindowManager.addAppToken(
                    addPos, r.appToken, r.task.taskId, r.info.screenOrientation, r.fullscreen,
            mService.mWindowManager.addAppToken(addPos, r.userId, r.appToken,
                    r.task.taskId, r.info.screenOrientation, r.fullscreen,
                    (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0);
            boolean doShow = true;
            if (newTask) {
@@ -1914,8 +1914,8 @@ final class ActivityStack {
        } else {
            // If this is the first activity, don't do any fancy animations,
            // because there is nothing for it to animate on top of.
            mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId,
                    r.info.screenOrientation, r.fullscreen,
            mService.mWindowManager.addAppToken(addPos, r.userId, r.appToken,
                    r.task.taskId, r.info.screenOrientation, r.fullscreen,
                    (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0);
            ActivityOptions.abort(options);
        }
Loading