diff options
3 files changed, 27 insertions, 10 deletions
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java index ff10287f3f89..a585d75e5d7a 100644 --- a/core/java/android/widget/TextClock.java +++ b/core/java/android/widget/TextClock.java @@ -555,7 +555,15 @@ public class TextClock extends TextView { filter.addAction(Intent.ACTION_TIME_CHANGED); filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); - getContext().registerReceiver(mIntentReceiver, filter, null, getHandler()); + // OK, this is gross but needed. This class is supported by the + // remote views mechanism and as a part of that the remote views + // can be inflated by a context for another user without the app + // having interact users permission - just for loading resources. + // For example, when adding widgets from a managed profile to the + // home screen. Therefore, we register the receiver as the user + // the app is running as not the one the context is for. + getContext().registerReceiverAsUser(mIntentReceiver, android.os.Process.myUserHandle(), + filter, null, getHandler()); } private void registerObserver() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index 86c1fca17a88..c2521b3d7d56 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -65,8 +65,6 @@ import java.util.List; import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; -import com.google.android.collect.Lists; - /** * Contains functionality for handling keyboard shortcuts. */ @@ -371,7 +369,7 @@ public final class KeyboardShortcuts { private KeyboardShortcutGroup getDefaultApplicationShortcuts() { final int userId = mContext.getUserId(); - List<KeyboardShortcutInfo> keyboardShortcutInfoAppItems = Lists.newArrayList(); + List<KeyboardShortcutInfo> keyboardShortcutInfoAppItems = new ArrayList<>(); // Assist. final AssistUtils assistUtils = new AssistUtils(mContext); diff --git a/services/core/java/com/android/server/webkit/SystemImpl.java b/services/core/java/com/android/server/webkit/SystemImpl.java index ed935ced0037..a5d68dabbdeb 100644 --- a/services/core/java/com/android/server/webkit/SystemImpl.java +++ b/services/core/java/com/android/server/webkit/SystemImpl.java @@ -34,7 +34,6 @@ import android.provider.Settings.Global; import android.provider.Settings; import android.util.AndroidRuntimeException; import android.util.Log; -import android.webkit.WebViewFactory.MissingWebViewPackageException; import android.webkit.WebViewFactory; import android.webkit.WebViewProviderInfo; @@ -68,6 +67,7 @@ public class SystemImpl implements SystemInterface { @Override public WebViewProviderInfo[] getWebViewPackages() { int numFallbackPackages = 0; + int numAvailableByDefaultPackages = 0; XmlResourceParser parser = null; List<WebViewProviderInfo> webViewProviders = new ArrayList<WebViewProviderInfo>(); try { @@ -83,12 +83,12 @@ public class SystemImpl implements SystemInterface { if (element.equals(TAG_WEBVIEW_PROVIDER)) { String packageName = parser.getAttributeValue(null, TAG_PACKAGE_NAME); if (packageName == null) { - throw new MissingWebViewPackageException( + throw new AndroidRuntimeException( "WebView provider in framework resources missing package name"); } String description = parser.getAttributeValue(null, TAG_DESCRIPTION); if (description == null) { - throw new MissingWebViewPackageException( + throw new AndroidRuntimeException( "WebView provider in framework resources missing description"); } boolean availableByDefault = "true".equals( @@ -100,22 +100,33 @@ public class SystemImpl implements SystemInterface { readSignatures(parser)); if (currentProvider.isFallback) { numFallbackPackages++; + if (!currentProvider.availableByDefault) { + throw new AndroidRuntimeException( + "Each WebView fallback package must be available by default."); + } if (numFallbackPackages > 1) { throw new AndroidRuntimeException( - "There can be at most one webview fallback package."); + "There can be at most one WebView fallback package."); } } + if (currentProvider.availableByDefault) { + numAvailableByDefaultPackages++; + } webViewProviders.add(currentProvider); } else { - Log.e(TAG, "Found an element that is not a webview provider"); + Log.e(TAG, "Found an element that is not a WebView provider"); } } } catch (XmlPullParserException | IOException e) { - throw new MissingWebViewPackageException("Error when parsing WebView meta data " + e); + throw new AndroidRuntimeException("Error when parsing WebView config " + e); } finally { if (parser != null) parser.close(); } + if (numAvailableByDefaultPackages == 0) { + throw new AndroidRuntimeException("There must be at least one WebView package " + + "that is available by default"); + } return webViewProviders.toArray(new WebViewProviderInfo[webViewProviders.size()]); } |