summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-01-29 15:35:05 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-29 20:49:58 -0800
commitc377217d3ebd503fb91c55ac871c981f99ec649c (patch)
treed36ab22603eb32f173c5ed6ac8666c4f65b2aeba /java
parentf27f1bd028abfcac714cf5aed6bbbab8d21077a6 (diff)
Use application context when fetching shared prefs.
Using non-application contexts incurs extra disk access because shared prefs are cached per context. Test: manually ejected sim and observed no strict mode violations PiperOrigin-RevId: 183739285 Change-Id: I9337e226ae1e060478219cf495752ceccf5a31e6
Diffstat (limited to 'java')
-rw-r--r--java/com/android/voicemail/impl/OmtpService.java4
-rw-r--r--java/com/android/voicemail/impl/VisualVoicemailPreferences.java2
2 files changed, 3 insertions, 3 deletions
diff --git a/java/com/android/voicemail/impl/OmtpService.java b/java/com/android/voicemail/impl/OmtpService.java
index 4e8860c02..e10a27571 100644
--- a/java/com/android/voicemail/impl/OmtpService.java
+++ b/java/com/android/voicemail/impl/OmtpService.java
@@ -197,14 +197,14 @@ public class OmtpService extends VisualVoicemailService {
}
private static void setShuttingDown(Context context, boolean value) {
- PreferenceManager.getDefaultSharedPreferences(context)
+ PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext())
.edit()
.putBoolean(IS_SHUTTING_DOWN, value)
.apply();
}
private static boolean isShuttingDown(Context context) {
- return PreferenceManager.getDefaultSharedPreferences(context)
+ return PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext())
.getBoolean(IS_SHUTTING_DOWN, false);
}
}
diff --git a/java/com/android/voicemail/impl/VisualVoicemailPreferences.java b/java/com/android/voicemail/impl/VisualVoicemailPreferences.java
index 72506eb93..1d7204e94 100644
--- a/java/com/android/voicemail/impl/VisualVoicemailPreferences.java
+++ b/java/com/android/voicemail/impl/VisualVoicemailPreferences.java
@@ -31,7 +31,7 @@ public class VisualVoicemailPreferences extends PerAccountSharedPreferences {
super(
context,
phoneAccountHandle,
- PreferenceManager.getDefaultSharedPreferences(context),
+ PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()),
"visual_voicemail_");
}
}