Merge "Merge "Clear native shader when Paint shader changes" into oc-dev am: d3e78478aa am: e871596f15" into oc-dr1-dev-plus-aosp
am: 70329318de

Change-Id: I4b49d917620b0659605866063478fd24aa285ba7
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index e0abfb5..ba2f7f0 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3973,6 +3973,15 @@
         };
 
         /**
+         * Keys we no longer back up under the current schema, but want to continue to
+         * process when restoring historical backup datasets.
+         *
+         * @hide
+         */
+        public static final String[] LEGACY_RESTORE_SETTINGS = {
+        };
+
+        /**
          * These are all public system settings
          *
          * @hide
@@ -7092,6 +7101,10 @@
             NOTIFICATION_BADGING
         };
 
+        /** @hide */
+        public static final String[] LEGACY_RESTORE_SETTINGS = {
+        };
+
         /**
          * These entries are considered common between the personal and the managed profile,
          * since the managed profile doesn't get to change them.
@@ -10095,6 +10108,10 @@
             BLUETOOTH_ON
         };
 
+        /** @hide */
+        public static final String[] LEGACY_RESTORE_SETTINGS = {
+        };
+
         private static final ContentProviderHolder sProviderHolder =
                 new ContentProviderHolder(CONTENT_URI);
 
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 58a6a5e..2b73c14 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -29,6 +29,7 @@
 import android.graphics.GraphicBuffer;
 import android.graphics.Point;
 import android.graphics.Rect;
+import android.graphics.Region;
 import android.os.Bundle;
 import android.os.IRemoteCallback;
 import android.os.ParcelFileDescriptor;
@@ -377,4 +378,9 @@
      * associated with that InputConsumer.
      */
     boolean destroyInputConsumer(String name);
+
+    /**
+     * Return the touch region for the current IME window, or an empty region if there is none.
+     */
+    Region getCurrentImeTouchRegion();
 }
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 533c52b..96f51c1 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -16,6 +16,7 @@
 
 package com.android.providers.settings;
 
+import android.annotation.Nullable;
 import android.annotation.UserIdInt;
 import android.app.backup.BackupAgentHelper;
 import android.app.backup.BackupDataInput;
@@ -30,7 +31,6 @@
 import android.net.Uri;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
-import android.os.Handler;
 import android.os.ParcelFileDescriptor;
 import android.os.UserHandle;
 import android.provider.Settings;
@@ -590,14 +590,18 @@
             Log.i(TAG, "restoreSettings: " + contentUri);
         }
 
-        // Figure out the white list and redirects to the global table.
+        // Figure out the white list and redirects to the global table.  We restore anything
+        // in either the backup whitelist or the legacy-restore whitelist for this table.
         final String[] whitelist;
         if (contentUri.equals(Settings.Secure.CONTENT_URI)) {
-            whitelist = Settings.Secure.SETTINGS_TO_BACKUP;
+            whitelist = concat(Settings.Secure.SETTINGS_TO_BACKUP,
+                    Settings.Secure.LEGACY_RESTORE_SETTINGS);
         } else if (contentUri.equals(Settings.System.CONTENT_URI)) {
-            whitelist = Settings.System.SETTINGS_TO_BACKUP;
+            whitelist = concat(Settings.System.SETTINGS_TO_BACKUP,
+                    Settings.System.LEGACY_RESTORE_SETTINGS);
         } else if (contentUri.equals(Settings.Global.CONTENT_URI)) {
-            whitelist = Settings.Global.SETTINGS_TO_BACKUP;
+            whitelist = concat(Settings.Global.SETTINGS_TO_BACKUP,
+                    Settings.Global.LEGACY_RESTORE_SETTINGS);
         } else {
             throw new IllegalArgumentException("Unknown URI: " + contentUri);
         }
@@ -648,6 +652,18 @@
         }
     }
 
+    private final String[] concat(String[] first, @Nullable String[] second) {
+        if (second == null || second.length == 0) {
+            return first;
+        }
+        final int firstLen = first.length;
+        final int secondLen = second.length;
+        String[] both = new String[firstLen + secondLen];
+        System.arraycopy(first, 0, both, 0, firstLen);
+        System.arraycopy(second, 0, both, firstLen, secondLen);
+        return both;
+    }
+
     /**
      * Restores the owner info enabled and other settings in LockSettings.
      *
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 4b066c0..98910ea 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -6188,6 +6188,17 @@
     }
 
     @Override
+    public Region getCurrentImeTouchRegion() {
+        synchronized (mWindowMap) {
+            final Region r = new Region();
+            if (mInputMethodWindow != null) {
+                mInputMethodWindow.getTouchableRegion(r);
+            }
+            return r;
+        }
+    }
+
+    @Override
     public boolean hasNavigationBar() {
         return mPolicy.hasNavigationBar();
     }