summaryrefslogtreecommitdiffstats
path: root/src/com/android/server/telecom/QuickResponseUtils.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-09-17 12:19:39 -0700
committerTyler Gunn <tgunn@google.com>2014-09-17 12:19:39 -0700
commit91d43cf9c985cc5a83795f256ef5c46ebb8fbdc1 (patch)
tree14551cd3cc9a0de2e96bffe1e8499c0b297d748b /src/com/android/server/telecom/QuickResponseUtils.java
parentb3c4b285b747c58bfa58e2c58e09cdfb2c2b03b8 (diff)
downloadandroid_packages_services_Telecomm-91d43cf9c985cc5a83795f256ef5c46ebb8fbdc1.tar.gz
android_packages_services_Telecomm-91d43cf9c985cc5a83795f256ef5c46ebb8fbdc1.tar.bz2
android_packages_services_Telecomm-91d43cf9c985cc5a83795f256ef5c46ebb8fbdc1.zip
Preparatory work to move Telecom to system service.
- Removed use of TelecomApp.getInstance() as context. - Refactored singleton logic and initialization to support being performed from a SystemService. - Note: You will see some commented out references to "import com.android.internal.R"; these must uncommented when the code is moved to a system service. - You will also notice in PhoneAccountRegistrar.java a comment block with: "UNCOMMENT_FOR_MOVE_TO_SYSTEM_SERVICE" The code in that comment block will replace the existing file path code. These were added as a convenience so that I can run a simple sed script to make the required changes to the code in an automated manner once it is moved to its new location. Bug: 17364651 Change-Id: I8e80e9cffc481b688c10a2bca0b59f5ccf8e0fb2
Diffstat (limited to 'src/com/android/server/telecom/QuickResponseUtils.java')
-rw-r--r--src/com/android/server/telecom/QuickResponseUtils.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/com/android/server/telecom/QuickResponseUtils.java b/src/com/android/server/telecom/QuickResponseUtils.java
index dad2907c..ec77b33e 100644
--- a/src/com/android/server/telecom/QuickResponseUtils.java
+++ b/src/com/android/server/telecom/QuickResponseUtils.java
@@ -21,6 +21,7 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
+// TODO: Needed for move to system service: import com.android.internal.R;
/**
* Utils class that exposes some helper routines to used to manage the QuickResponses
@@ -48,7 +49,7 @@ public class QuickResponseUtils {
* current SharedPreferences. This is a lazy migration as it happens only when
* the QuickResponse settings are viewed or if they are queried via RespondViaSmsManager.
*/
- public static void maybeMigrateLegacyQuickResponses() {
+ public static void maybeMigrateLegacyQuickResponses(Context context) {
// The algorithm will go as such:
// If Telecom QuickResponses exist, we will skip migration because this implies
// that a user has already specified their desired QuickResponses and have abandoned any
@@ -59,11 +60,9 @@ public class QuickResponseUtils {
// function is called.
Log.d(LOG_TAG, "maybeMigrateLegacyQuickResponses() - Starting");
-
- final Context telecomContext = TelecomApp.getInstance();
- final SharedPreferences prefs = telecomContext.getSharedPreferences(
+ final SharedPreferences prefs = context.getSharedPreferences(
SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
- final Resources res = telecomContext.getResources();
+ final Resources res = context.getResources();
final boolean responsesExist = prefs.contains(KEY_CANNED_RESPONSE_PREF_1);
if (responsesExist) {
@@ -84,7 +83,7 @@ public class QuickResponseUtils {
// the Telephony package and we'll fall back on using our default values.
Context telephonyContext = null;
try {
- telephonyContext = telecomContext.createPackageContext(PACKAGE_NAME_TELEPHONY, 0);
+ telephonyContext = context.createPackageContext(PACKAGE_NAME_TELEPHONY, 0);
} catch (PackageManager.NameNotFoundException e) {
Log.e(LOG_TAG, e, "maybeMigrateLegacyQuickResponses() - Can't find Telephony package.");
}