diff options
author | Steve Kondik <shade@chemlab.org> | 2012-11-18 22:53:20 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-11-18 22:53:20 -0800 |
commit | fac65f50fbe296e71e3316cf31afadbf99f242de (patch) | |
tree | 71bb5df49824b838d9e867f7ef6a47024b0dfb1e | |
parent | c344227e88cadd9ff1d95b9aca0983e12646767c (diff) | |
parent | ac72bff9a1fdb69260e53b277547bf4e32e8e43f (diff) | |
download | packages_apps_Stk-fac65f50fbe296e71e3316cf31afadbf99f242de.zip packages_apps_Stk-fac65f50fbe296e71e3316cf31afadbf99f242de.tar.gz packages_apps_Stk-fac65f50fbe296e71e3316cf31afadbf99f242de.tar.bz2 |
Merge branch 'jb-mr1-release' of https://android.googlesource.com/platform/packages/apps/Stk into HEAD
Change-Id: I106c365f504a0ed50179044835bafefd300866f4
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | AndroidManifest.xml | 4 | ||||
-rw-r--r-- | res/values-fa/strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/stk/StkAppService.java | 22 | ||||
-rw-r--r-- | src/com/android/stk/ToneDialog.java | 13 |
5 files changed, 24 insertions, 18 deletions
@@ -5,6 +5,7 @@ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional +LOCAL_JAVA_LIBRARIES := telephony-common LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_PACKAGE_NAME := Stk diff --git a/AndroidManifest.xml b/AndroidManifest.xml index a54826e..994abdb 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -16,6 +16,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" package="com.android.stk" android:sharedUserId="android.uid.phone"> @@ -80,7 +81,8 @@ </intent-filter> </receiver> - <receiver android:name="com.android.stk.BootCompletedReceiver"> + <receiver android:name="com.android.stk.BootCompletedReceiver" + androidprv:primaryUserOnly="true"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index 9850cbb..bef8ddd 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -29,7 +29,7 @@ <string name="alphabet" msgid="1583185545938805861">"الفبا"</string> <string name="digits" msgid="1746796679021682388">"ارقام (0-9، *، #، +)"</string> <string name="default_call_setup_msg" msgid="7960194995759849940">"تماس در حال انجام..."</string> - <string name="stk_app_state" msgid="18582277302584082">"حالت برنامه کاربردی"</string> + <string name="stk_app_state" msgid="18582277302584082">"حالت برنامهٔ کاربردی"</string> <string name="enable_app" msgid="3701224550936728203">"فعال شد"</string> <string name="disable_app" msgid="6725081975611415214">"غیرفعال شد"</string> <string name="stk_dialog_title" msgid="6954825385456886726">"کیت ابزار سیم کارت"</string> diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java index 1007a4a..9dcd25b 100644 --- a/src/com/android/stk/StkAppService.java +++ b/src/com/android/stk/StkAppService.java @@ -144,20 +144,11 @@ public class StkAppService extends Service implements Runnable { @Override public void onCreate() { // Initialize members + // This can return null if StkService is not yet instantiated, but it's ok + // If this is null we will do getInstance before we need to use this mStkService = com.android.internal.telephony.cat.CatService .getInstance(); - // NOTE mStkService is a singleton and continues to exist even if the GSMPhone is disposed - // after the radio technology change from GSM to CDMA so the PHONE_TYPE_CDMA check is - // needed. In case of switching back from CDMA to GSM the GSMPhone constructor updates - // the instance. (TODO: test). - if ((mStkService == null) - && (TelephonyManager.getDefault().getPhoneType() - != TelephonyManager.PHONE_TYPE_CDMA)) { - CatLog.d(this, " Unable to get Service handle"); - return; - } - mCmdsQ = new LinkedList<DelayedCmd>(); Thread serviceThread = new Thread(null, this, "Stk App Service"); serviceThread.start(); @@ -488,6 +479,15 @@ public class StkAppService extends Service implements Runnable { if (mCurrentCmd == null) { return; } + if (mStkService == null) { + mStkService = com.android.internal.telephony.cat.CatService.getInstance(); + if (mStkService == null) { + // This should never happen (we should be responding only to a message + // that arrived from StkService). It has to exist by this time + throw new RuntimeException("mStkService is null when we need to send response"); + } + } + CatResponseMessage resMsg = new CatResponseMessage(mCurrentCmd); // set result code diff --git a/src/com/android/stk/ToneDialog.java b/src/com/android/stk/ToneDialog.java index eaba498..0ad6ee8 100644 --- a/src/com/android/stk/ToneDialog.java +++ b/src/com/android/stk/ToneDialog.java @@ -38,7 +38,7 @@ public class ToneDialog extends Activity { TextMessage toneMsg = null; ToneSettings settings = null; TonePlayer player = null; - Vibrator mVibrator = null; + boolean mIsResponseSent = false; /** * Handler used to stop tones from playing when the duration ends. @@ -55,6 +55,7 @@ public class ToneDialog extends Activity { } }; + Vibrator mVibrator; // Message id to signal tone duration timeout. private static final int MSG_ID_STOP_TONE = 0xda; @@ -63,9 +64,9 @@ public class ToneDialog extends Activity { protected void onCreate(Bundle icicle) { super.onCreate(icicle); - initFromIntent(getIntent()); + mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE); - mVibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); + initFromIntent(getIntent()); // remove window title View title = findViewById(com.android.internal.R.id.title); @@ -100,8 +101,9 @@ public class ToneDialog extends Activity { @Override protected void onDestroy() { super.onDestroy(); - - mToneStopper.removeMessages(MSG_ID_STOP_TONE); + if (mIsResponseSent) { + mToneStopper.removeMessages(MSG_ID_STOP_TONE); + } player.stop(); player.release(); mVibrator.cancel(); @@ -131,5 +133,6 @@ public class ToneDialog extends Activity { args.putInt(StkAppService.OPCODE, StkAppService.OP_RESPONSE); args.putInt(StkAppService.RES_ID, resId); startService(new Intent(this, StkAppService.class).putExtras(args)); + mIsResponseSent = true; } } |