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

Commit 8abb26ee authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Preserve widgets on upgrade. Bug #2464545"

parents cea6ac36 d2671e1f
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
@@ -271,8 +270,9 @@ public class Dialog implements DialogInterface, Window.Callback,
            return;
        }

        try {
            mWindowManager.removeView(mDecor);

        } finally {
            mDecor = null;
            mWindow.closeAllPanels();
            onStop();
@@ -280,6 +280,7 @@ public class Dialog implements DialogInterface, Window.Callback,
            
            sendDismissMessage();
        }
    }

    private void sendDismissMessage() {
        if (mDismissMessage != null) {
+10 −0
Original line number Diff line number Diff line
@@ -184,6 +184,16 @@ public class AppWidgetManager {
     */
    public static final String META_DATA_APPWIDGET_PROVIDER = "android.appwidget.provider";
    
    /**
     * Field for the manifest meta-data tag used to indicate any previous name for the
     * app widget receiver.
     *
     * @see AppWidgetProviderInfo
     * 
     * @hide Pending API approval
     */
    public static final String META_DATA_APPWIDGET_OLD_NAME = "android.appwidget.oldName";

    static WeakHashMap<Context, WeakReference<AppWidgetManager>> sManagerCache = new WeakHashMap();
    static IAppWidgetService sService;
    
+12 −0
Original line number Diff line number Diff line
@@ -99,6 +99,18 @@ public class AppWidgetProviderInfo implements Parcelable {
     */
    public int icon;
    
    
    /**
     * The previous name, if any, of the app widget receiver. If not supplied, it will be
     * ignored.
     *
     * <p>This field corresponds to the <code>&lt;meta-data /&gt;</code> with the name
     * <code>android.appwidget.oldName</code>.
     * 
     * @hide Pending API approval
     */
    public String oldName;

    public AppWidgetProviderInfo() {
    }

+6 −1
Original line number Diff line number Diff line
@@ -524,10 +524,11 @@ class AppWidgetService extends IAppWidgetService.Stub
    }

    Provider lookupProviderLocked(ComponentName provider) {
        final String className = provider.getClassName();
        final int N = mInstalledProviders.size();
        for (int i=0; i<N; i++) {
            Provider p = mInstalledProviders.get(i);
            if (p.info.provider.equals(provider)) {
            if (p.info.provider.equals(provider) || className.equals(p.info.oldName)) {
                return p;
            }
        }
@@ -706,6 +707,10 @@ class AppWidgetService extends IAppWidgetService.Stub

            p = new Provider();
            AppWidgetProviderInfo info = p.info = new AppWidgetProviderInfo();
            // If metaData was null, we would have returned earlier when getting
            // the parser No need to do the check here
            info.oldName = activityInfo.metaData.getString(
                    AppWidgetManager.META_DATA_APPWIDGET_OLD_NAME);

            info.provider = component;
            p.uid = activityInfo.applicationInfo.uid;