Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Created December 6, 2016 19:22
Show Gist options
  • Save invisiblek/a80b4e44c75fd38b34f88482bc3650b8 to your computer and use it in GitHub Desktop.
Save invisiblek/a80b4e44c75fd38b34f88482bc3650b8 to your computer and use it in GitHub Desktop.
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d406021..30aad01 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -96,6 +96,14 @@
</intent-filter>
</activity>
+ <!-- Full-screen version of CellBroadcastAlertDialog to display alerts over lock screen. -->
+ <activity android:name="CellBroadcastAlertFullScreen"
+ android:excludeFromRecents="true"
+ android:theme="@style/AlertFullScreenTheme"
+ android:launchMode="singleTask"
+ android:exported="false"
+ android:configChanges="orientation|keyboardHidden|keyboard|navigation" />
+
<!-- Container activity for CMAS opt-in/opt-out dialog. -->
<activity android:name="CellBroadcastOptOutActivity"
android:exported="false" />
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
index f88acfd..64858d4 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
@@ -41,6 +41,7 @@ import android.telephony.SmsCbEtwsInfo;
import android.telephony.SmsCbLocation;
import android.telephony.SmsCbMessage;
import android.telephony.SubscriptionManager;
+import android.telephony.CarrierConfigManager;
import android.util.Log;
import com.android.internal.telephony.PhoneConstants;
@@ -214,7 +215,11 @@ public class CellBroadcastAlertService extends Service {
}
final CellBroadcastMessage cbm = new CellBroadcastMessage(message);
- int subId = intent.getExtras().getInt(PhoneConstants.SUBSCRIPTION_KEY);
+ int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
+ SubscriptionManager.getDefaultSmsSubscriptionId());
+ if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ subId = SubscriptionManager.getDefaultSubscriptionId();
+ }
if (SubscriptionManager.isValidSubscriptionId(subId)) {
cbm.setSubId(subId);
} else {
@@ -248,11 +253,6 @@ public class CellBroadcastAlertService extends Service {
}
}
- subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
- SubscriptionManager.getDefaultSmsSubscriptionId());
- if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
- subId = SubscriptionManager.getDefaultSubscriptionId();
- }
boolean carrierDisableDupDetection = false;
CarrierConfigManager configManager =
(CarrierConfigManager) getSystemService(Context.CARRIER_CONFIG_SERVICE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment