diff options
Diffstat (limited to 'core/java/android/widget/AnalogClock.java')
-rw-r--r-- | core/java/android/widget/AnalogClock.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/widget/AnalogClock.java b/core/java/android/widget/AnalogClock.java index 5b80648..1716dbd 100644 --- a/core/java/android/widget/AnalogClock.java +++ b/core/java/android/widget/AnalogClock.java @@ -111,7 +111,15 @@ public class AnalogClock extends View { filter.addAction(Intent.ACTION_TIME_CHANGED); filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); - getContext().registerReceiver(mIntentReceiver, 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(mIntentReceiver, + android.os.Process.myUserHandle(), filter, null, mHandler); } // NOTE: It's safe to do these after registering the receiver since the receiver always runs |