summaryrefslogtreecommitdiff
path: root/src/com/android/deskclock/controller/Controller.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/deskclock/controller/Controller.java')
-rw-r--r--src/com/android/deskclock/controller/Controller.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/com/android/deskclock/controller/Controller.java b/src/com/android/deskclock/controller/Controller.java
index 82487e0f7..5272bbe00 100644
--- a/src/com/android/deskclock/controller/Controller.java
+++ b/src/com/android/deskclock/controller/Controller.java
@@ -46,15 +46,14 @@ public final class Controller implements VoiceController {
}
public void setContext(Context context) {
- if (mContext != null) {
- throw new IllegalStateException("context has already been set");
- }
- mContext = context;
- if (Utils.isMOrLater()) {
- mVoiceController = new DefaultVoiceController();
- }
- if (Utils.isNMR1OrLater()) {
- mShortcutController = new ShortcutController(mContext);
+ if (mContext != context) {
+ mContext = context.getApplicationContext();
+ if (Utils.isMOrLater()) {
+ mVoiceController = new DefaultVoiceController();
+ }
+ if (Utils.isNMR1OrLater()) {
+ mShortcutController = new ShortcutController(mContext);
+ }
}
}