[automerger skipped] Import translations. DO NOT MERGE ANYWHERE am: 1d3da1daf1 -s ours am: c01e675480 -s ours am: 784b8e9299 -s ours am: fcb53a36a7 -s ours
am skip reason: subject contains skip directive
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Stk/+/24916835
Change-Id: Ia2ae43bf280d3b381ee63caa9dc3410c7b5b1a27
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 348e798..d8aff68 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -130,6 +130,12 @@
</intent-filter>
</receiver>
+ <receiver android:name="com.android.stk.UserPresentReceiver"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.USER_PRESENT" />
+ </intent-filter>
+ </receiver>
<service android:name="StkAppService" />
</application>
diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml
index e791e6d..da8762c 100644
--- a/res/values-eu/strings.xml
+++ b/res/values-eu/strings.xml
@@ -41,6 +41,6 @@
<string name="default_close_channel_msg" msgid="6320648502339362951">"Kanala itxita dago"</string>
<string name="stk_dialog_accept" msgid="2899431442032305374">"BAI"</string>
<string name="stk_dialog_reject" msgid="1455086565615694879">"EZ"</string>
- <string name="no_sim_card_inserted" msgid="3177955793136053581">"Sartu SIM txartela SIM tresnak abiarazteko."</string>
+ <string name="no_sim_card_inserted" msgid="3177955793136053581">"Sartu SIMa SIM tresnak exekutatzeko."</string>
<string name="stk_channel_name" msgid="3945765236566954372">"Zerbitzu mugikorraren mezuak"</string>
</resources>
diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml
index a3c33bc..3738f0b 100644
--- a/res/values-in/strings.xml
+++ b/res/values-in/strings.xml
@@ -32,7 +32,7 @@
<string name="default_setup_call_msg" msgid="5819132588246209714">"Panggilan yang sedang disiapkan"</string>
<string name="stk_app_state" msgid="6274976677198791616">"Status aplikasi"</string>
<string name="enable_app" msgid="1980493713217690903">"Diaktifkan"</string>
- <string name="disable_app" msgid="2298201833946002357">"Dinonaktifkan"</string>
+ <string name="disable_app" msgid="2298201833946002357">"Nonaktif"</string>
<string name="stk_dialog_title" msgid="1047336800509270520">"SIM ToolKit"</string>
<string name="default_tone_dialog_msg" msgid="8354658178971283852">"Memutar Nada"</string>
<string name="default_open_channel_msg" msgid="2043011408855389673">"Buka Saluran?"</string>
diff --git a/res/values-ne/strings.xml b/res/values-ne/strings.xml
index 4b0be8d..d4a47da 100644
--- a/res/values-ne/strings.xml
+++ b/res/values-ne/strings.xml
@@ -42,5 +42,5 @@
<string name="stk_dialog_accept" msgid="2899431442032305374">"हो"</string>
<string name="stk_dialog_reject" msgid="1455086565615694879">"होइन"</string>
<string name="no_sim_card_inserted" msgid="3177955793136053581">"SIM टुलकिट लञ्च गर्न कृपया SIM घुसाउनुहोस्।"</string>
- <string name="stk_channel_name" msgid="3945765236566954372">"मोबाइल सेवाका सन्देशहरू"</string>
+ <string name="stk_channel_name" msgid="3945765236566954372">"मोबाइल सेवाका म्यासेजहरू"</string>
</resources>
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index 52b06fb..4d26fa6 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -74,7 +74,6 @@
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.PhoneConfigurationManager;
-import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.cat.AppInterface;
import com.android.internal.telephony.cat.CatCmdMessage;
@@ -300,6 +299,7 @@
private static final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey";
private static final String SYSTEM_DIALOG_REASON_RECENTAPPS_KEY = "recentapps";
private BroadcastReceiver mHomeKeyEventReceiver = null;
+ private static final int NOTIFICATION_PENDING_INTENT_REQUEST_CODE = 0;
@Override
public void onCreate() {
@@ -1690,47 +1690,26 @@
builder.setOnlyAlertOnce(true);
builder.setColor(getResources().getColor(
com.android.internal.R.color.system_notification_accent_color));
-
- registerUserPresentReceiver();
+ Intent userPresentIntent = new Intent(mContext, UserPresentReceiver.class);
+ userPresentIntent.setAction(Intent.ACTION_USER_PRESENT);
+ PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext,
+ NOTIFICATION_PENDING_INTENT_REQUEST_CODE, userPresentIntent,
+ PendingIntent.FLAG_IMMUTABLE);
+ builder.setContentIntent(pendingIntent);
mNotificationManager.notify(getNotificationId(NOTIFICATION_ON_KEYGUARD, slotId),
builder.build());
mStkContext[slotId].mNotificationOnKeyguard = true;
}
+ public void cancelNotificationOnKeyguard() {
+ for (int slot = 0; slot < mSimCount; slot++) {
+ cancelNotificationOnKeyguard(slot);
+ }
+ }
+
private void cancelNotificationOnKeyguard(int slotId) {
mNotificationManager.cancel(getNotificationId(NOTIFICATION_ON_KEYGUARD, slotId));
mStkContext[slotId].mNotificationOnKeyguard = false;
- unregisterUserPresentReceiver(slotId);
- }
-
- private synchronized void registerUserPresentReceiver() {
- if (mUserPresentReceiver == null) {
- mUserPresentReceiver = new BroadcastReceiver() {
- @Override public void onReceive(Context context, Intent intent) {
- if (Intent.ACTION_USER_PRESENT.equals(intent.getAction())) {
- for (int slot = 0; slot < mSimCount; slot++) {
- cancelNotificationOnKeyguard(slot);
- }
- }
- }
- };
- registerReceiver(mUserPresentReceiver, new IntentFilter(Intent.ACTION_USER_PRESENT));
- }
- }
-
- private synchronized void unregisterUserPresentReceiver(int slotId) {
- if (mUserPresentReceiver != null) {
- for (int slot = 0; slot < mSimCount; slot++) {
- if (slot != slotId) {
- if (mStkContext[slot].mNotificationOnKeyguard) {
- // The broadcast receiver is still necessary for other SIM card.
- return;
- }
- }
- }
- unregisterReceiver(mUserPresentReceiver);
- mUserPresentReceiver = null;
- }
}
private int getNotificationId(int notificationType, int slotId) {
diff --git a/src/com/android/stk/UserPresentReceiver.java b/src/com/android/stk/UserPresentReceiver.java
new file mode 100644
index 0000000..25c945c
--- /dev/null
+++ b/src/com/android/stk/UserPresentReceiver.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+package com.android.stk;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import com.android.internal.telephony.cat.CatLog;
+
+public class UserPresentReceiver extends BroadcastReceiver {
+
+ private static final String LOG_TAG = UserPresentReceiver.class.getSimpleName();
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (Intent.ACTION_USER_PRESENT.equals(intent.getAction())) {
+ CatLog.d(LOG_TAG, "Broadcast received and clearing the notification");
+ StkAppService.getInstance().cancelNotificationOnKeyguard();
+ }
+ }
+}