diff options
author | Svetoslav <svetoslavganov@google.com> | 2014-07-16 15:12:03 -0700 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-08-06 11:01:36 +0100 |
commit | 39999cf0263d0568337a87d0e586dcafd9e22ba1 (patch) | |
tree | 1e38f5f5a2d899db203ea4375d11bbb4369fad36 /core/java/android/widget/ViewFlipper.java | |
parent | 8a0ee34c7047b0b3c0869b0c173a210b40fd3050 (diff) | |
download | frameworks_base-39999cf0263d0568337a87d0e586dcafd9e22ba1.zip frameworks_base-39999cf0263d0568337a87d0e586dcafd9e22ba1.tar.gz frameworks_base-39999cf0263d0568337a87d0e586dcafd9e22ba1.tar.bz2 |
Allow adding widgets from user profiles.
The goal of this change is to enable support for appwidget from
user profiles to the user main profile. A user profile is a user
which is associated as a child of the main user profile. For example,
a user may have a personal (parent) and corporate (child) profile.
The device policy should be able to control whether adding a widget
from a child profile and given packages is allowed. This change
assumes that all packages from managed profiles are white listed.
Another change will add the device policy changes.
(cherrypicked 8cd27c3c to work around Gerrit issue)
Change-Id: I267260b55d74c48b112a29979a9f59eef7a8194e
Diffstat (limited to 'core/java/android/widget/ViewFlipper.java')
-rw-r--r-- | core/java/android/widget/ViewFlipper.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/core/java/android/widget/ViewFlipper.java b/core/java/android/widget/ViewFlipper.java index b152297..cf1f554 100644 --- a/core/java/android/widget/ViewFlipper.java +++ b/core/java/android/widget/ViewFlipper.java @@ -21,8 +21,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.TypedArray; -import android.os.Handler; -import android.os.Message; +import android.os.*; import android.util.AttributeSet; import android.util.Log; import android.view.accessibility.AccessibilityEvent; @@ -90,7 +89,16 @@ public class ViewFlipper extends ViewAnimator { final IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_USER_PRESENT); - getContext().registerReceiver(mReceiver, filter, null, mHandler); + + // OK, this is gross but needed. This class is supported by the + // remote views machanism 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 exmaple, when adding widgets from a user profile to the + // home screen. Therefore, we register the receiver as the current + // user not the one the context is for. + getContext().registerReceiverAsUser(mReceiver, android.os.Process.myUserHandle(), + filter, null, mHandler); if (mAutoStart) { // Automatically start when requested |