Skip to content

Commit 4d810d4

Browse files
author
Sarah Chin
committed
Move phone ID to extra for action provision
Previously, the phone ID was appended to the broadcast in DCT and sent to ConnectivityManager. Instead of sending both as an action, send the phone ID as an extra instead to make the action a protected broadcast. Test: manually verify a SecurityException when action provision is sent Test: atest DcTrackerTest Bug: 172459128 Change-Id: Ic4129def86949d7191d15056852718dadbd72fba Merged-In: Ic4129def86949d7191d15056852718dadbd72fba
1 parent 11ed014 commit 4d810d4

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

core/java/android/net/ConnectivityManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3115,9 +3115,9 @@ public String getMobileProvisioningUrl() {
31153115
}
31163116

31173117
/**
3118-
* Set sign in error notification to visible or in visible
3118+
* Set sign in error notification to visible or invisible
31193119
*
3120-
* {@hide}
3120+
* @hide
31213121
* @deprecated Doesn't properly deal with multiple connected networks of the same type.
31223122
*/
31233123
@Deprecated

services/core/java/com/android/server/connectivity/NetworkNotificationManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,13 @@ public void clearNotification(int id) {
324324
*/
325325
public void setProvNotificationVisible(boolean visible, int id, String action) {
326326
if (visible) {
327-
Intent intent = new Intent(action);
327+
// For legacy purposes, action is sent as the action + the phone ID from DcTracker.
328+
// Split the string here and send the phone ID as an extra instead.
329+
String[] splitAction = action.split(":");
330+
Intent intent = new Intent(splitAction[0]);
331+
try {
332+
intent.putExtra("provision.phone.id", Integer.parseInt(splitAction[1]));
333+
} catch (NumberFormatException ignored) { }
328334
PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
329335
showNotification(id, NotificationType.SIGN_IN, null, null, pendingIntent, false);
330336
} else {

0 commit comments

Comments
 (0)