summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Sandler <dsandler@android.com>2015-07-30 22:33:12 -0400
committerDan Sandler <dsandler@android.com>2015-07-30 22:33:12 -0400
commit4b67713709342dfa6d0059637aed49b457d2c62a (patch)
tree3a67272a3ab7edf7371d45668c982e96c626eb8b
parent706274f7ff9e1e7eb01f93ae80f7189de7fe6694 (diff)
downloadframeworks_base-4b67713709342dfa6d0059637aed49b457d2c62a.zip
frameworks_base-4b67713709342dfa6d0059637aed49b457d2c62a.tar.gz
frameworks_base-4b67713709342dfa6d0059637aed49b457d2c62a.tar.bz2
Make DateTimeView more robust to weird contexts.
In particular, some clients (*ahem* SystemUI) have been known to inflate RemoteViews with unusual derived contexts that may not have valid application contexts. DateTimeView can now resist this. Bug: 22852700 Change-Id: I5e91ae0e66859f5f5efd7b19c0ae6dfbc26bcc54
-rw-r--r--core/java/android/widget/DateTimeView.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/widget/DateTimeView.java b/core/java/android/widget/DateTimeView.java
index dcb2437..d20b924 100644
--- a/core/java/android/widget/DateTimeView.java
+++ b/core/java/android/widget/DateTimeView.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.app.ActivityThread;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -259,7 +260,7 @@ public class DateTimeView extends TextView {
static final Context getApplicationContextIfAvailable(Context context) {
final Context ac = context.getApplicationContext();
- return ac != null ? ac : context;
+ return ac != null ? ac : ActivityThread.currentApplication().getApplicationContext();
}
void register(Context context) {