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

Commit 9bfb7075 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Various fixes and improvements to window, activity.

- New meta-data you can add to a dock activity to have it launched by the
  home key when the device is in that dock.

- Fix a deadlock involving ActivityThread's internal content provider lock.

- New window flag to have a non-secure keyguard entirely dismissed when a
  window is displayed.

- New WindowManagerPolicy APIs to allow the policy to tell the system when
  a change it makes during layout may cause the wall paper or
  overall configuration to change.

- Fix a bug where an application token removed while one of its windows is
  animating could cause the animating window to get stuck on screen.

Change-Id: I6d33fd39edd796bb9bdfd9dd7e077b84ca62ea08
parent c0b8a96d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -36906,6 +36906,17 @@
 visibility="public"
>
</field>
<field name="METADATA_DOCK_HOME"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.dock_home&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="URI_INTENT_SCHEME"
 type="int"
 transient="false"
@@ -160428,6 +160439,17 @@
 visibility="public"
>
</field>
<field name="FLAG_DISMISS_KEYGUARD"
 type="int"
 transient="false"
 volatile="false"
 value="4194304"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FLAG_DITHER"
 type="int"
 transient="false"
+22 −6
Original line number Diff line number Diff line
@@ -1765,6 +1765,7 @@ public final class ActivityThread {
        public static final int CREATE_BACKUP_AGENT     = 128;
        public static final int DESTROY_BACKUP_AGENT    = 129;
        public static final int SUICIDE                 = 130;
        public static final int REMOVE_PROVIDER         = 131;
        String codeToString(int code) {
            if (localLOGV) {
                switch (code) {
@@ -1799,6 +1800,7 @@ public final class ActivityThread {
                    case CREATE_BACKUP_AGENT: return "CREATE_BACKUP_AGENT";
                    case DESTROY_BACKUP_AGENT: return "DESTROY_BACKUP_AGENT";
                    case SUICIDE: return "SUICIDE";
                    case REMOVE_PROVIDER: return "REMOVE_PROVIDER";
                }
            }
            return "(unknown)";
@@ -1911,9 +1913,10 @@ public final class ActivityThread {
                    handleDestroyBackupAgent((CreateBackupAgentData)msg.obj);
                    break;
                case SUICIDE:
                    {
                    Process.killProcess(Process.myPid());
                    }
                    break;
                case REMOVE_PROVIDER:
                    completeRemoveProvider((IContentProvider)msg.obj);
                    break;
            }
        }
@@ -4029,15 +4032,28 @@ public final class ActivityThread {
            } else {
                prc.count--;
                if(prc.count == 0) {
                    mProviderRefCountMap.remove(jBinder);
                    //invoke removeProvider to dereference provider
                    removeProviderLocked(provider);
                    // Schedule the actual remove asynchronously, since we
                    // don't know the context this will be called in.
                    Message msg = mH.obtainMessage(H.REMOVE_PROVIDER, provider);
                    mH.sendMessage(msg);
                } //end if
            } //end else
        } //end synchronized
        return true;
    }

    final void completeRemoveProvider(IContentProvider provider) {
        IBinder jBinder = provider.asBinder();
        synchronized(mProviderMap) {
            ProviderRefCount prc = mProviderRefCountMap.get(jBinder);
            if(prc != null && prc.count == 0) {
                mProviderRefCountMap.remove(jBinder);
                //invoke removeProvider to dereference provider
                removeProviderLocked(provider);
            }
        }
    }
    
    public final void removeProviderLocked(IContentProvider provider) {
        if (provider == null) {
            return;
+8 −2
Original line number Diff line number Diff line
@@ -2055,6 +2055,12 @@ public class Intent implements Parcelable {
     */
    public static final int EXTRA_DOCK_STATE_CAR = 2;

    /**
     * Boolean that can be supplied as meta-data with a dock activity, to
     * indicate that the dock should take over the home key when it is active.
     */
    public static final String METADATA_DOCK_HOME = "android.dock_home";
    
    /**
     * Used as a parcelable extra field in {@link #ACTION_APP_ERROR}, containing
     * the bug report.
@@ -3605,7 +3611,7 @@ public class Intent implements Parcelable {
            }
        } else {
            ResolveInfo info = pm.resolveActivity(
                this, PackageManager.MATCH_DEFAULT_ONLY);
                this, PackageManager.MATCH_DEFAULT_ONLY | flags);
            if (info != null) {
                ai = info.activityInfo;
            }
+17 −1
Original line number Diff line number Diff line
@@ -488,7 +488,10 @@ public interface WindowManager extends ViewManager {
         * is locked. This will let application windows take precedence over
         * key guard or any other lock screens. Can be used with
         * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
         * directly before showing the key guard window
         * directly before showing the key guard window.  Can be used with
         * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
         * non-secure keyguards.  This flag only applies to the top-most
         * full-screen window.
         */
        public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;

@@ -506,6 +509,19 @@ public interface WindowManager extends ViewManager {
         * up the device) to turn the screen on. */
        public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
        
        /** Window flag: when set the window will cause the keyguard to
         * be dismissed, only if it is not a secure lock keyguard.  Because such
         * a keyguard is not needed for security, it will never re-appear if
         * the user navigates to another window (in contrast to
         * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
         * hide both secure and non-secure keyguards but ensure they reappear
         * when the user moves to another UI that doesn't hide them).
         * If the keyguard is currently active and is secure (requires an
         * unlock pattern) than the user will still need to confirm it before
         * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
         * also been set. */
        public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
        
        /** Window flag: special flag to limit the size of the window to be
         * original size ([320x480] x density). Used to create window for applications
         * running under compatibility mode.
+10 −3
Original line number Diff line number Diff line
@@ -602,10 +602,17 @@ public interface WindowManagerPolicy {
     * returned, all windows given to layoutWindow() <em>must</em> have had a
     * frame assigned.
     *  
     * @return Return true if layout state may have changed (so that another 
     *         layout will be performed).
     * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}
     * and {@link #FINISH_LAYOUT_REDO_CONFIG}.
     */
    public boolean finishLayoutLw();
    public int finishLayoutLw();

    /** Layout state may have changed (so another layout will be performed) */
    static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
    /** Configuration state may have changed */
    static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
    /** Wallpaper may need to move */
    static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
    
    /**
     * Called when animation of the windows is about to start.
Loading