summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp5
-rw-r--r--AndroidManifest.xml1
-rw-r--r--src/com/android/stk/StkAppService.java18
3 files changed, 14 insertions, 10 deletions
diff --git a/Android.bp b/Android.bp
index 03bb2ef..ac68d5a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -20,7 +20,10 @@ license {
android_app {
name: "Stk",
libs: ["telephony-common"],
- static_libs: ["com.google.android.material_material"],
+ static_libs: [
+ "com.google.android.material_material",
+ "androidx.legacy_legacy-support-core-utils",
+ ],
srcs: ["**/*.java"],
platform_apis: true,
certificate: "platform",
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4a644c3..81ba3d8 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -26,6 +26,7 @@
<uses-permission android:name="android.permission.REAL_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.QUERY_ALL_PACKAGES" />
<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" />
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index c507171..46fc55a 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -24,7 +24,7 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.AlertDialog;
-import android.app.HomeVisibilityObserver;
+import android.app.HomeVisibilityListener;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationChannel;
@@ -170,7 +170,7 @@ public class StkAppService extends Service implements Runnable {
private AppInterface[] mStkService = null;
private StkContext[] mStkContext = null;
private int mSimCount = 0;
- private HomeVisibilityObserver mHomeVisibilityObserver = null;
+ private HomeVisibilityListener mHomeVisibilityListener = null;
private BroadcastReceiver mLocaleChangeReceiver = null;
private TonePlayer mTonePlayer = null;
private Vibrator mVibrator = null;
@@ -1850,8 +1850,8 @@ public class StkAppService extends Service implements Runnable {
}
private synchronized void registerHomeVisibilityObserver() {
- if (mHomeVisibilityObserver == null) {
- mHomeVisibilityObserver = new HomeVisibilityObserver() {
+ if (mHomeVisibilityListener == null) {
+ mHomeVisibilityListener = new HomeVisibilityListener() {
@Override
public void onHomeVisibilityChanged(boolean isHomeActivityVisible) {
if (isHomeActivityVisible) {
@@ -1862,7 +1862,7 @@ public class StkAppService extends Service implements Runnable {
}
};
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
- am.registerHomeVisibilityObserver(mHomeVisibilityObserver);
+ am.addHomeVisibilityListener(Runnable::run, mHomeVisibilityListener);
CatLog.d(LOG_TAG, "Started to observe the foreground activity");
}
}
@@ -1894,11 +1894,11 @@ public class StkAppService extends Service implements Runnable {
}
private synchronized void unregisterHomeVisibilityObserver() {
- if (mHomeVisibilityObserver != null) {
+ if (mHomeVisibilityListener != null) {
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
- am.unregisterHomeVisibilityObserver(mHomeVisibilityObserver);
+ am.removeHomeVisibilityListener(mHomeVisibilityListener);
CatLog.d(LOG_TAG, "Stopped to observe the foreground activity");
- mHomeVisibilityObserver = null;
+ mHomeVisibilityListener = null;
}
}
@@ -2143,7 +2143,7 @@ public class StkAppService extends Service implements Runnable {
+ "] icon[" + msg.icon + "], sim id: " + slotId);
CatLog.d(LOG_TAG, "Add IdleMode text");
PendingIntent pendingIntent = PendingIntent.getService(mContext, 0,
- new Intent(mContext, StkAppService.class), 0);
+ new Intent(mContext, StkAppService.class), PendingIntent.FLAG_IMMUTABLE);
createAllChannels();
final Notification.Builder notificationBuilder = new Notification.Builder(
StkAppService.this, STK_NOTIFICATION_CHANNEL_ID);