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
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user