Merge "Revert "Split Stk into a client apk and a lib."" am: 1070174ee0

Change-Id: I38d05db267c77d935befd2cd48742dc78f9fecb0
diff --git a/Android.bp b/Android.bp
index f041f41..cffb421 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,21 +1,10 @@
 // Copyright 2007-2008 The Android Open Source Project
 
 android_app {
-    name: "StkLib",
+    name: "Stk",
     libs: ["telephony-common"],
     static_libs: ["com.google.android.material_material"],
     srcs: ["**/*.java"],
     platform_apis: true,
     certificate: "platform",
-    aaptflags: [
-        "--shared-lib",
-        "--extra-packages com.android.stk",
-    ],
-    export_package_resources: true,
-    optimize: {
-        proguard_flags_files: [
-            "proguard.proguard",
-        ],
-    },
-    apex_available: [ "com.android.telephony" ],
 }
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 1a6af77..c49ff86 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -16,10 +16,116 @@
 
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.stk.lib">
+        xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+        package="com.android.stk"
+        android:sharedUserId="android.uid.phone">
 
-    <application>
-        <library android:name="com.android.stk.lib" />
+    <original-package android:name="com.android.stk" />
+
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+    <uses-permission android:name="android.permission.GET_TASKS"/>
+    <uses-permission android:name="android.permission.RECEIVE_STK_COMMANDS" />
+    <uses-permission android:name="android.permission.SET_ACTIVITY_WATCHER" />
+    <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
+    <uses-permission android:name="android.permission.USER_ACTIVITY" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+
+    <application android:icon="@drawable/ic_launcher_sim_toolkit"
+        android:label="@string/app_name"
+        android:clearTaskOnLaunch="true"
+        android:process="com.android.phone"
+        android:taskAffinity="android.task.stk"
+        android:defaultToDeviceProtectedStorage="true"
+        android:directBootAware="true">
+
+        <activity android:name="StkMain"
+            android:theme="@android:style/Theme.NoDisplay"
+            android:label="@string/app_name"
+            android:enabled="false"
+            android:exported="true"
+            android:autoRemoveFromRecents="true"
+            android:taskAffinity="android.task.stk.StkLauncherActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name="StkLauncherActivity"
+            android:theme="@android:style/Theme.DeviceDefault.DayNight"
+            android:label="@string/app_name"
+            android:exported="false"
+            android:autoRemoveFromRecents="true"
+            android:taskAffinity="android.task.stk.StkLauncherActivity">
+            <intent-filter>
+                 <action android:name="android.intent.action.VIEW" />
+                 <action android:name="android.intent.action.PICK" />
+                 <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name="StkMenuActivity"
+            android:theme="@android:style/Theme.DeviceDefault.DayNight"
+            android:icon="@drawable/ic_launcher_sim_toolkit"
+            android:label="@string/app_name"
+            android:configChanges="orientation|locale|screenSize|keyboardHidden|mnc|mcc"
+            android:exported="false"
+            android:autoRemoveFromRecents="true"
+            android:taskAffinity="android.task.stk.StkLauncherActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <action android:name="android.intent.action.PICK" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name="StkInputActivity"
+            android:label="@string/app_name"
+            android:icon="@drawable/ic_launcher_sim_toolkit"
+            android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
+            android:configChanges="orientation|locale|screenSize|keyboardHidden"
+            android:exported="false"
+            android:autoRemoveFromRecents="true"
+            android:taskAffinity="android.task.stk.StkLauncherActivity">
+                <intent-filter>
+                        <action android:name="android.intent.action.VIEW" />
+                        <action android:name="android.intent.action.EDIT" />
+                        <category android:name="android.intent.category.DEFAULT" />
+                </intent-filter>
+        </activity>
+        <activity android:name="StkDialogActivity"
+            android:configChanges="orientation|locale|screenSize|keyboardHidden"
+            android:theme="@style/Transparent"
+            android:exported="false"
+            android:autoRemoveFromRecents="true"
+            android:taskAffinity="android.task.stk.StkLauncherActivity">
+        </activity>
+
+        <activity android:name="ToneDialog"
+            android:exported="false"
+            android:theme="@style/Transparent"
+            android:autoRemoveFromRecents="true"
+            android:taskAffinity="android.task.stk.StkLauncherActivity">
+        </activity>
+
+        <receiver android:name="com.android.stk.StkCmdReceiver">
+            <intent-filter>
+                <action android:name= "com.android.internal.stk.command" />
+                <action android:name= "com.android.internal.stk.session_end" />
+                <action android:name= "com.android.internal.stk.icc_status_change" />
+                <action android:name= "com.android.internal.stk.alpha_notify" />
+            </intent-filter>
+        </receiver>
+
+        <receiver android:name="com.android.stk.BootCompletedReceiver">
+            <intent-filter>
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.intent.action.USER_INITIALIZE" />
+            </intent-filter>
+        </receiver>
+
+        <service android:name="StkAppService" />
+
     </application>
-
 </manifest>
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 5c0114b..3c98e58 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -48,3 +48,4 @@
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/StkLib)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/StkLib)
diff --git a/client/Android.bp b/client/Android.bp
deleted file mode 100644
index 45896e3..0000000
--- a/client/Android.bp
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2007-2008 The Android Open Source Project
-
-android_app {
-    name: "Stk",
-    static_libs: ["com.google.android.material_material"],
-    platform_apis: true,
-    certificate: "platform",
-    required: ["StkLib"],
-}
diff --git a/client/AndroidManifest.xml b/client/AndroidManifest.xml
deleted file mode 100644
index bf9604c..0000000
--- a/client/AndroidManifest.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-
-<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">
-
-    <original-package android:name="com.android.stk" />
-
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
-    <uses-permission android:name="android.permission.GET_TASKS"/>
-    <uses-permission android:name="android.permission.RECEIVE_STK_COMMANDS" />
-    <uses-permission android:name="android.permission.SET_ACTIVITY_WATCHER" />
-    <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
-    <uses-permission android:name="android.permission.USER_ACTIVITY" />
-    <uses-permission android:name="android.permission.VIBRATE" />
-    <uses-permission android:name="android.permission.WAKE_LOCK" />
-
-    <application android:icon="@drawable/ic_launcher_sim_toolkit"
-        android:label="@string/app_name"
-        android:clearTaskOnLaunch="true"
-        android:process="com.android.phone"
-        android:taskAffinity="android.task.stk"
-        android:defaultToDeviceProtectedStorage="true"
-        android:directBootAware="true">
-
-        <uses-library android:name="com.android.stk.lib" />
-
-        <activity android:name="StkMain"
-            android:theme="@android:style/Theme.NoDisplay"
-            android:label="@string/app_name"
-            android:enabled="false"
-            android:exported="true"
-            android:autoRemoveFromRecents="true"
-            android:taskAffinity="android.task.stk.StkLauncherActivity">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name="StkLauncherActivity"
-            android:theme="@android:style/Theme.DeviceDefault.DayNight"
-            android:label="@string/app_name"
-            android:exported="false"
-            android:autoRemoveFromRecents="true"
-            android:taskAffinity="android.task.stk.StkLauncherActivity">
-            <intent-filter>
-                 <action android:name="android.intent.action.VIEW" />
-                 <action android:name="android.intent.action.PICK" />
-                 <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name="StkMenuActivity"
-            android:theme="@android:style/Theme.DeviceDefault.DayNight"
-            android:icon="@drawable/ic_launcher_sim_toolkit"
-            android:label="@string/app_name"
-            android:configChanges="orientation|locale|screenSize|keyboardHidden|mnc|mcc"
-            android:exported="false"
-            android:autoRemoveFromRecents="true"
-            android:taskAffinity="android.task.stk.StkLauncherActivity">
-            <intent-filter>
-                <action android:name="android.intent.action.VIEW" />
-                <action android:name="android.intent.action.PICK" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name="StkInputActivity"
-            android:label="@string/app_name"
-            android:icon="@drawable/ic_launcher_sim_toolkit"
-            android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
-            android:configChanges="orientation|locale|screenSize|keyboardHidden"
-            android:exported="false"
-            android:autoRemoveFromRecents="true"
-            android:taskAffinity="android.task.stk.StkLauncherActivity">
-                <intent-filter>
-                        <action android:name="android.intent.action.VIEW" />
-                        <action android:name="android.intent.action.EDIT" />
-                        <category android:name="android.intent.category.DEFAULT" />
-                </intent-filter>
-        </activity>
-        <activity android:name="StkDialogActivity"
-            android:configChanges="orientation|locale|screenSize|keyboardHidden"
-            android:theme="@style/Transparent"
-            android:exported="false"
-            android:autoRemoveFromRecents="true"
-            android:taskAffinity="android.task.stk.StkLauncherActivity">
-        </activity>
-
-        <activity android:name="ToneDialog"
-            android:exported="false"
-            android:theme="@style/Transparent"
-            android:autoRemoveFromRecents="true"
-            android:taskAffinity="android.task.stk.StkLauncherActivity">
-        </activity>
-
-        <receiver android:name="com.android.stk.StkCmdReceiver">
-            <intent-filter>
-                <action android:name= "com.android.internal.stk.command" />
-                <action android:name= "com.android.internal.stk.session_end" />
-                <action android:name= "com.android.internal.stk.icc_status_change" />
-                <action android:name= "com.android.internal.stk.alpha_notify" />
-            </intent-filter>
-        </receiver>
-
-        <receiver android:name="com.android.stk.BootCompletedReceiver">
-            <intent-filter>
-                <action android:name="android.intent.action.BOOT_COMPLETED" />
-                <action android:name="android.intent.action.USER_INITIALIZE" />
-            </intent-filter>
-        </receiver>
-
-        <service android:name="StkAppService" />
-
-    </application>
-</manifest>
diff --git a/client/res/drawable-hdpi/ic_launcher_sim_toolkit.png b/client/res/drawable-hdpi/ic_launcher_sim_toolkit.png
deleted file mode 100644
index d6ebaaf..0000000
--- a/client/res/drawable-hdpi/ic_launcher_sim_toolkit.png
+++ /dev/null
Binary files differ
diff --git a/client/res/drawable-mdpi/ic_launcher_sim_toolkit.png b/client/res/drawable-mdpi/ic_launcher_sim_toolkit.png
deleted file mode 100644
index 9ff189f..0000000
--- a/client/res/drawable-mdpi/ic_launcher_sim_toolkit.png
+++ /dev/null
Binary files differ
diff --git a/client/res/drawable-xhdpi/ic_launcher_sim_toolkit.png b/client/res/drawable-xhdpi/ic_launcher_sim_toolkit.png
deleted file mode 100644
index fcc57be..0000000
--- a/client/res/drawable-xhdpi/ic_launcher_sim_toolkit.png
+++ /dev/null
Binary files differ
diff --git a/client/res/drawable-xxhdpi/ic_launcher_sim_toolkit.png b/client/res/drawable-xxhdpi/ic_launcher_sim_toolkit.png
deleted file mode 100644
index 9aed66b..0000000
--- a/client/res/drawable-xxhdpi/ic_launcher_sim_toolkit.png
+++ /dev/null
Binary files differ
diff --git a/client/res/drawable-xxxhdpi/ic_launcher_sim_toolkit.png b/client/res/drawable-xxxhdpi/ic_launcher_sim_toolkit.png
deleted file mode 100644
index b56c624..0000000
--- a/client/res/drawable-xxxhdpi/ic_launcher_sim_toolkit.png
+++ /dev/null
Binary files differ
diff --git a/client/res/values/strings.xml b/client/res/values/strings.xml
deleted file mode 100644
index adf1605..0000000
--- a/client/res/values/strings.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <!-- Default Application label used on home screen with an icon -->
-    <string name="app_name">SIM Toolkit</string>
-</resources>
diff --git a/client/res/values/styles.xml b/client/res/values/styles.xml
deleted file mode 100644
index 7d43798..0000000
--- a/client/res/values/styles.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <style name="Transparent" parent="@android:style/Theme.DeviceDefault.DayNight">
-        <item name="android:windowIsTranslucent">true</item>
-        <item name="android:windowBackground">@android:color/transparent</item>
-        <item name="android:windowContentOverlay">@null</item>
-        <item name="android:windowNoTitle">true</item>
-        <item name="android:windowIsFloating">true</item>
-        <item name="android:backgroundDimEnabled">true</item>
-        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
-    </style>
-</resources>
diff --git a/proguard.proguard b/proguard.proguard
deleted file mode 100644
index 2a823d8..0000000
--- a/proguard.proguard
+++ /dev/null
@@ -1,7 +0,0 @@
--keepparameternames
--keepattributes Exceptions,InnerClasses,Signature,Deprecated,
-                SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-
--keep public class * {
-    public protected *;
-}
\ No newline at end of file
diff --git a/src/com/android/stk/StkInputActivity.java b/src/com/android/stk/StkInputActivity.java
index fe16101..0af6767 100644
--- a/src/com/android/stk/StkInputActivity.java
+++ b/src/com/android/stk/StkInputActivity.java
@@ -105,18 +105,22 @@
             return;
         }
 
-        if (v.getId() == R.id.button_ok) {
+        switch (v.getId()) {
+        case R.id.button_ok:
             input = mTextIn.getText().toString();
-        } else if (v.getId() == R.id.button_cancel) {
+            break;
+        case R.id.button_cancel:
             sendResponse(StkAppService.RES_ID_END_SESSION);
             finish();
             return;
-            // Yes/No layout buttons.
-        } else if (v.getId() == R.id.button_yes) {
+        // Yes/No layout buttons.
+        case R.id.button_yes:
             input = YES_STR_RESPONSE;
-        } else if (v.getId() == R.id.button_no) {
+            break;
+        case R.id.button_no:
             input = NO_STR_RESPONSE;
-        } else if (v.getId() == R.id.more) {
+            break;
+        case R.id.more:
             if (mPopupMenu == null) {
                 mPopupMenu = new PopupMenu(this, v);
                 Menu menu = mPopupMenu.getMenu();
@@ -136,6 +140,8 @@
                 mPopupMenu.show();
             }
             return;
+        default:
+            break;
         }
         CatLog.d(LOG_TAG, "handleClick, ready to response");
         sendResponse(StkAppService.RES_ID_INPUT, input, false);