Revert "Remove deprecated unenforced permission from manifest." and replace it with a valid current permission. am: 9a5cf012cb am: 42c8d32134

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Stk/+/12062157

Change-Id: Ia3b7038abe992384357d3e197d353c407c337afa
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 063e042..4a644c3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -109,7 +109,8 @@
             android:taskAffinity="android.task.stk.StkLauncherActivity">
         </activity>
 
-        <receiver android:name="com.android.stk.StkCmdReceiver">
+        <receiver android:name="com.android.stk.StkCmdReceiver"
+            android:exported="true">
             <intent-filter>
                 <action android:name= "com.android.internal.stk.command" />
                 <action android:name= "com.android.internal.stk.session_end" />
@@ -118,7 +119,8 @@
             </intent-filter>
         </receiver>
 
-        <receiver android:name="com.android.stk.BootCompletedReceiver">
+        <receiver android:name="com.android.stk.BootCompletedReceiver"
+            android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.BOOT_COMPLETED" />
                 <action android:name="android.intent.action.USER_INITIALIZE" />
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 9f86610..c78dbbe 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -1085,13 +1085,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
@@ -2324,6 +2317,10 @@
         }
     }
 
+    boolean isNoTonePlaying() {
+        return mTonePlayer == null ? true : false;
+    }
+
     private void launchOpenChannelDialog(final int slotId) {
         TextMessage msg = mStkContext[slotId].mCurrentCmd.geTextMessage();
         if (msg == null) {
diff --git a/src/com/android/stk/ToneDialog.java b/src/com/android/stk/ToneDialog.java
index 2efeecd..639a216 100644
--- a/src/com/android/stk/ToneDialog.java
+++ b/src/com/android/stk/ToneDialog.java
@@ -92,6 +92,12 @@
 
         mAlertDialog = alertDialogBuilder.create();
         mAlertDialog.show();
+
+        StkAppService appService = StkAppService.getInstance();
+        // Finish the activity if the specified duration is too short and timed-out already.
+        if (appService != null && (appService.isNoTonePlaying())) {
+            finish();
+        }
     }
 
     @Override