diff options
3 files changed, 35 insertions, 2 deletions
diff --git a/service/ServiceResources/res/drawable/ic_restart.xml b/service/ServiceResources/res/drawable/ic_restart.xml new file mode 100644 index 0000000..24d7c34 --- /dev/null +++ b/service/ServiceResources/res/drawable/ic_restart.xml @@ -0,0 +1,26 @@ +<!-- + ~ Copyright (C) 2021 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. + --> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="@android:color/white"> + <path + android:fillColor="@android:color/black" + android:pathData="M6,13c0,-1.65 0.67,-3.15 1.76,-4.24L6.34,7.34C4.9,8.79 4,10.79 4,13c0,4.08 3.05,7.44 7,7.93v-2.02c-2.83,-0.48 -5,-2.94 -5,-5.91zM20,13c0,-4.42 -3.58,-8 -8,-8 -0.06,0 -0.12,0.01 -0.18,0.01l1.09,-1.09L11.5,2.5 8,6l3.5,3.5 1.41,-1.41 -1.08,-1.08c0.06,0 0.12,-0.01 0.17,-0.01 3.31,0 6,2.69 6,6 0,2.97 -2.17,5.43 -5,5.91v2.02c3.95,-0.49 7,-3.85 7,-7.93z"/> +</vector> diff --git a/service/ServiceResources/res/values/strings.xml b/service/ServiceResources/res/values/strings.xml index 53407e0..ed60624 100644 --- a/service/ServiceResources/res/values/strings.xml +++ b/service/ServiceResources/res/values/strings.xml @@ -3,5 +3,7 @@ <!-- Title text for a notification that instructs the user to reboot to apply new server flags to the device [CHAR LIMIT=NONE] --> <string name="boot_notification_title">New flags available</string> <!-- Content text for a notification that instructs the user to reboot to apply new server flags to the device [CHAR LIMIT=NONE] --> - <string name="boot_notification_content">Tap to reboot and apply new trunkfood flag values</string> + <string name="boot_notification_content">Your device has new trunkfood flags available. A restart is required to apply them.</string> + <!-- Action text for a button that instructs the user to reboot to apply new server flags to the device [CHAR LIMIT=NONE] --> + <string name="boot_notification_action_text">Tap to reboot</string> </resources> diff --git a/service/java/com/android/server/deviceconfig/BootNotificationCreator.java b/service/java/com/android/server/deviceconfig/BootNotificationCreator.java index 388fedc..38a4e57 100644 --- a/service/java/com/android/server/deviceconfig/BootNotificationCreator.java +++ b/service/java/com/android/server/deviceconfig/BootNotificationCreator.java @@ -3,6 +3,7 @@ package com.android.server.deviceconfig; import android.annotation.NonNull; import android.app.AlarmManager; import android.app.Notification; +import android.app.Notification.Action; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; @@ -114,11 +115,15 @@ class BootNotificationCreator implements OnPropertiesChangedListener { try { Context resourcesContext = context.createPackageContext(RESOURCES_PACKAGE, 0); + Action action = new Action.Builder( + Icon.createWithResource(resourcesContext, R.drawable.ic_restart), + resourcesContext.getString(R.string.boot_notification_action_text), + pendingIntent).build(); Notification notification = new Notification.Builder(context, CHANNEL_ID) .setContentText(resourcesContext.getString(R.string.boot_notification_content)) .setContentTitle(resourcesContext.getString(R.string.boot_notification_title)) .setSmallIcon(Icon.createWithResource(resourcesContext, R.drawable.ic_flag)) - .setContentIntent(pendingIntent) + .addAction(action) .build(); notificationManager.notify(NOTIFICATION_ID, notification); } catch (NameNotFoundException e) { |