Merge QP1A.190418.001
Change-Id: Ib86b729fde0e557aee0abe1a1ab2cef0d0631c33
diff --git a/res/layout/stk_input.xml b/res/layout/stk_input.xml
index 7f8f96d..73e9977 100644
--- a/res/layout/stk_input.xml
+++ b/res/layout/stk_input.xml
@@ -19,6 +19,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
+ <LinearLayout android:id="@+id/titleBar"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"
+ android:orientation="horizontal">
+ <ImageView android:id="@+id/icon"
+ android:layout_width="25dp"
+ android:layout_height="25dp"
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="8dp" />
+ </LinearLayout>
<ImageButton
style="@android:style/Widget.Material.ActionButton.Overflow"
android:id="@+id/more"
@@ -30,6 +40,7 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
+ android:layoutDirection="locale"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index cb9564e..a277aab 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -295,6 +295,10 @@
// system property to set the STK specific default url for launch browser proactive cmds
private static final String STK_BROWSER_DEFAULT_URL_SYSPROP = "persist.radio.stk.default_url";
+ // Description of the Icon that is being dispalyed in a Stk activity.
+ public static final String TEXT_DEFAULT_ICON = "Stk Default Icon";
+ public static final String TEXT_ICON_FROM_COMMAND="Stk Icon from Command";
+
private static final int NOTIFICATION_ON_KEYGUARD = 1;
private static final long[] VIBRATION_PATTERN = new long[] { 0, 350, 250, 350 };
private BroadcastReceiver mUserPresentReceiver = null;
@@ -732,8 +736,10 @@
} else {
IccRefreshResponse state = new IccRefreshResponse();
state.refreshResult = args.getInt(AppInterface.REFRESH_RESULT);
+ state.aid = args.getString(AppInterface.AID);
- CatLog.d(LOG_TAG, "Icc Refresh Result: "+ state.refreshResult);
+ CatLog.d(LOG_TAG, "Icc Refresh Result: "+ state.refreshResult
+ + " aid: " + state.aid);
if ((state.refreshResult == IccRefreshResponse.REFRESH_RESULT_INIT) ||
(state.refreshResult == IccRefreshResponse.REFRESH_RESULT_RESET)) {
// Clear Idle Text
@@ -1032,13 +1038,6 @@
case DISPLAY_TEXT:
TextMessage msg = cmdMsg.geTextMessage();
waitForUsersResponse = msg.responseNeeded;
- if (mStkContext[slotId].lastSelectedItem != null) {
- msg.title = mStkContext[slotId].lastSelectedItem;
- } else if (mStkContext[slotId].mMainCmd != null){
- if (!getResources().getBoolean(R.bool.show_menu_title_only_on_menu)) {
- msg.title = mStkContext[slotId].mMainCmd.getMenu().title;
- }
- }
//If we receive a low priority Display Text and the device is
// not displaying any STK related activity and the screen is not idle
// ( that is, device is in an interactive state), then send a screen busy
@@ -1117,13 +1116,26 @@
break;
case SEND_DTMF:
case SEND_SMS:
- case REFRESH:
case RUN_AT:
case SEND_SS:
case SEND_USSD:
case GET_CHANNEL_STATUS:
waitForUsersResponse = false;
launchEventMessage(slotId);
+ //Reset the mCurrentCmd to mMainCmd, to avoid wrong TR sent for
+ //SEND_SMS/SS/USSD, when user launches STK app next time and do
+ //a menu selection.
+ mStkContext[slotId].mCurrentCmd = mStkContext[slotId].mMainCmd;
+ break;
+ case REFRESH:
+ waitForUsersResponse = false;
+ launchEventMessage(slotId);
+ // Idle mode text needs to be cleared for init or reset modes of refresh
+ if (cmdMsg.isRefreshResetOrInit()) {
+ mNotificationManager.cancel(getNotificationId(slotId));
+ mStkContext[slotId].mIdleModeTextCmd = null;
+ CatLog.d(this, "Clean idle mode text due to refresh");
+ }
break;
case LAUNCH_BROWSER:
// The device setup process should not be interrupted by launching browser.
@@ -2020,6 +2032,7 @@
ImageView iv = (ImageView) v
.findViewById(com.android.internal.R.id.icon);
if (msg.icon != null) {
+ iv.setContentDescription(TEXT_ICON_FROM_COMMAND);
iv.setImageBitmap(msg.icon);
} else {
iv.setVisibility(View.GONE);
@@ -2142,6 +2155,8 @@
.setSmallIcon(com.android.internal.R.drawable.stat_notify_sim_toolkit);
notificationBuilder.setContentIntent(pendingIntent);
notificationBuilder.setOngoing(true);
+ notificationBuilder.setStyle(new Notification.BigTextStyle(notificationBuilder)
+ .bigText(msg.text));
notificationBuilder.setOnlyAlertOnce(true);
// Set text and icon for the status bar and notification body.
if (mStkContext[slotId].mIdleModeTextCmd.hasIconLoadFailed() ||
@@ -2278,17 +2293,13 @@
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
| getFlagActivityNoUserAction(InitiatedByUserAction.unknown, slotId));
newIntent.putExtra("TEXT", mStkContext[slotId].mCurrentCmd.geTextMessage());
+ newIntent.putExtra("TONE", mStkContext[slotId].mCurrentCmd.getToneSettings());
newIntent.putExtra(SLOT_ID, slotId);
newIntent.setData(uriData);
startActivity(newIntent);
}
}
- private void finishToneDialogActivity() {
- Intent finishIntent = new Intent(FINISH_TONE_ACTIVITY_ACTION);
- sendBroadcast(finishIntent);
- }
-
private void handleStopTone(Message msg, int slotId) {
int resId = 0;
@@ -2297,9 +2308,6 @@
// 2.STOP_TONE_USER: user pressed the back key.
if (msg.arg1 == OP_STOP_TONE) {
resId = RES_ID_DONE;
- // Dismiss Tone dialog, after finishing off playing the tone.
- int finishActivity = (Integer) msg.obj;
- if (finishActivity == 1) finishToneDialogActivity();
} else if (msg.arg1 == OP_STOP_TONE_USER) {
resId = RES_ID_END_SESSION;
}
diff --git a/src/com/android/stk/StkCmdReceiver.java b/src/com/android/stk/StkCmdReceiver.java
index aeb4e22..3c3880f 100644
--- a/src/com/android/stk/StkCmdReceiver.java
+++ b/src/com/android/stk/StkCmdReceiver.java
@@ -73,6 +73,7 @@
args.putInt(AppInterface.REFRESH_RESULT,
intent.getIntExtra(AppInterface.REFRESH_RESULT,
IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE));
+ args.putString(AppInterface.AID, intent.getStringExtra(AppInterface.AID));
} else if (StkAppService.OP_ALPHA_NOTIFY == op) {
String alphaString = intent.getStringExtra(AppInterface.ALPHA_STRING);
args.putString(AppInterface.ALPHA_STRING, alphaString);
diff --git a/src/com/android/stk/StkDialogActivity.java b/src/com/android/stk/StkDialogActivity.java
index 1462480..299f40a 100644
--- a/src/com/android/stk/StkDialogActivity.java
+++ b/src/com/android/stk/StkDialogActivity.java
@@ -25,6 +25,7 @@
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
@@ -65,6 +66,10 @@
private AlertDialog mAlertDialog;
+ // system property to enable/disable adding content description
+ private static String ENABLE_CONTENT_DESCRIPTION = "persist.vendor.stk.enable_content";
+ private boolean mEnableContent = SystemProperties.getBoolean(ENABLE_CONTENT_DESCRIPTION, false);
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -136,8 +141,16 @@
if (mTextMsg.icon != null) {
iv.setImageBitmap(mTextMsg.icon);
+ if (mEnableContent) {
+ iv.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND + ": "
+ + mTextMsg.text);
+ }
} else {
- iv.setVisibility(View.GONE);
+ if (mEnableContent) {
+ iv.setContentDescription(StkAppService.TEXT_DEFAULT_ICON);
+ } else {
+ iv.setVisibility(View.GONE);
+ }
}
// Per spec, only set text if the icon is not provided or not self-explanatory
diff --git a/src/com/android/stk/StkInputActivity.java b/src/com/android/stk/StkInputActivity.java
index 356bcfc..3db5698 100644
--- a/src/com/android/stk/StkInputActivity.java
+++ b/src/com/android/stk/StkInputActivity.java
@@ -33,6 +33,7 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
@@ -166,6 +167,7 @@
}
}
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
// Set the layout for this activity.
setContentView(R.layout.stk_input);
@@ -499,6 +501,8 @@
if (mStkInput.icon != null) {
ImageView imageView = (ImageView) findViewById(R.id.icon);
+ imageView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND + ": "
+ + mStkInput.text);
imageView.setImageBitmap(mStkInput.icon);
imageView.setVisibility(View.VISIBLE);
}
diff --git a/src/com/android/stk/StkMenuActivity.java b/src/com/android/stk/StkMenuActivity.java
index 073de8d..e8e3602 100644
--- a/src/com/android/stk/StkMenuActivity.java
+++ b/src/com/android/stk/StkMenuActivity.java
@@ -419,6 +419,7 @@
// Display title & title icon
if (mStkMenu.titleIcon != null) {
mTitleIconView.setImageBitmap(mStkMenu.titleIcon);
+ mTitleIconView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND);
mTitleIconView.setVisibility(View.VISIBLE);
mTitleTextView.setVisibility(View.INVISIBLE);
if (!mStkMenu.titleIconSelfExplanatory) {
diff --git a/src/com/android/stk/StkMenuAdapter.java b/src/com/android/stk/StkMenuAdapter.java
index c53b3ac..4398280 100644
--- a/src/com/android/stk/StkMenuAdapter.java
+++ b/src/com/android/stk/StkMenuAdapter.java
@@ -60,6 +60,8 @@
} else {
imageView.setImageBitmap(item.icon);
imageView.setVisibility(View.VISIBLE);
+ // Add content description for the icon.
+ imageView.setContentDescription(StkAppService.TEXT_ICON_FROM_COMMAND);
}
return convertView;
diff --git a/src/com/android/stk/ToneDialog.java b/src/com/android/stk/ToneDialog.java
old mode 100755
new mode 100644
index 1c5fca6..48b6942
--- a/src/com/android/stk/ToneDialog.java
+++ b/src/com/android/stk/ToneDialog.java
@@ -32,7 +32,7 @@
import android.widget.TextView;
import com.android.internal.telephony.cat.CatLog;
import com.android.internal.telephony.cat.TextMessage;
-import com.android.internal.telephony.cat.CatLog;
+import com.android.internal.telephony.cat.ToneSettings;
/**
* Activity used to display tone dialog.
@@ -40,11 +40,27 @@
*/
public class ToneDialog extends Activity {
TextMessage toneMsg = null;
+ ToneSettings settings = null;
int mSlotId = -1;
private AlertDialog mAlertDialog;
private static final String LOG_TAG = new Object(){}.getClass().getEnclosingClass().getName();
+ Handler mToneStopper = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_ID_STOP_TONE:
+ CatLog.d(LOG_TAG, "Finishing Tone dialog activity");
+ finish();
+ break;
+ }
+ }
+ };
+
+ // Message id to signal tone duration timeout.
+ private static final int MSG_ID_STOP_TONE = 0xda;
+
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -53,8 +69,6 @@
initFromIntent(getIntent());
// Register receiver
IntentFilter filter = new IntentFilter();
- filter.addAction(StkAppService.FINISH_TONE_ACTIVITY_ACTION);
- registerReceiver(mFinishActivityReceiver, filter);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
@@ -81,6 +95,18 @@
tv.setVisibility(View.GONE);
}
+ if (null == settings) {
+ CatLog.d(LOG_TAG, "onCreate - null settings - finish");
+ finish();
+ return;
+ }
+
+ int timeout = StkApp.calculateDurationInMilis(settings.duration);
+ if (timeout == 0) {
+ timeout = StkApp.TONE_DEFAULT_TIMEOUT;
+ }
+ mToneStopper.sendEmptyMessageDelayed(MSG_ID_STOP_TONE, timeout);
+
alertDialogBuilder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
@@ -96,33 +122,21 @@
@Override
protected void onDestroy() {
CatLog.d(LOG_TAG, "onDestroy");
+ mToneStopper.removeMessages(MSG_ID_STOP_TONE);
super.onDestroy();
- unregisterReceiver(mFinishActivityReceiver);
-
if (mAlertDialog != null && mAlertDialog.isShowing()) {
mAlertDialog.dismiss();
mAlertDialog = null;
}
}
- private BroadcastReceiver mFinishActivityReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- // Intent received from StkAppService to finish ToneDialog activity,
- // after finishing off playing the tone.
- if (intent.getAction().equals(StkAppService.FINISH_TONE_ACTIVITY_ACTION)) {
- CatLog.d(this, "Finishing Tone dialog activity");
- finish();
- }
- }
- };
-
private void initFromIntent(Intent intent) {
if (intent == null) {
finish();
}
toneMsg = intent.getParcelableExtra("TEXT");
+ settings = intent.getParcelableExtra("TONE");
mSlotId = intent.getIntExtra(StkAppService.SLOT_ID, -1);
}