Skip to content

Commit

Permalink
add flag_mutable for PendingIntent
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed May 1, 2024
1 parent 917ab72 commit 8d3bda0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/github/uiautomator/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ public void onCreate() {
.setTicker(getString(R.string.monitor_service_ticker))
.setContentTitle(getString(R.string.monitor_service_title))
.setContentText(getString(R.string.monitor_service_text))
.setContentIntent(PendingIntent.getActivity(this, NOTIFICATION_ID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT))
.setContentIntent(PendingIntent.getActivity(this, NOTIFICATION_ID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE))
.setWhen(System.currentTimeMillis());
Notification notification = builder.build();
startForeground(NOTIFICATION_ID, notification);

// since atx-agent is remove since uiautomator2 3.x, so the following code is useless
HttpPostNotifier notifier = new HttpPostNotifier("http://127.0.0.1:7912");
Context context = getApplicationContext();
addMonitor(new BatteryMonitor(context, notifier));
// addMonitor(new BatteryMonitor(context, notifier));
addMonitor(new WifiMonitor(this, notifier));
}

Expand Down Expand Up @@ -117,7 +118,6 @@ public int onStartCommand(Intent intent, int flags, int startId) {
} else if (ACTION_STOP.equals(action)) {
stopSelf();
}

return START_NOT_STICKY; // not start again, when killed by system
}

Expand Down

0 comments on commit 8d3bda0

Please sign in to comment.