Loading packages/Tethering/res/values/strings.xml +19 −2 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2020 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. --> <resources> <!-- Shown when the device is tethered --> <!-- Strings for tethered notification title [CHAR LIMIT=200] --> Loading @@ -13,4 +27,7 @@ <string name="disable_tether_notification_title">Tethering is disabled</string> <!-- Strings for tether disabling notification message [CHAR LIMIT=200] --> <string name="disable_tether_notification_message">Contact your admin for details</string> <!-- Strings for tether notification channel name [CHAR LIMIT=200] --> <string name="notification_channel_tethering_status">Hotspot & tethering status</string> </resources> No newline at end of file packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java +9 −4 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import static android.telephony.CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANG import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -107,7 +108,6 @@ import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.internal.notification.SystemNotificationChannels; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.MessageUtils; import com.android.internal.util.State; Loading Loading @@ -692,6 +692,12 @@ public class Tethering { if (notificationManager == null) { return; } final NotificationChannel channel = new NotificationChannel( "TETHERING_STATUS", mContext.getResources().getString(R.string.notification_channel_tethering_status), NotificationManager.IMPORTANCE_LOW); notificationManager.createNotificationChannel(channel); int icon = 0; switch(id) { case SystemMessage.NOTE_TETHER_USB: Loading Loading @@ -735,12 +741,11 @@ public class Tethering { } if (mTetheredNotificationBuilder == null) { mTetheredNotificationBuilder = new Notification.Builder(mContext, SystemNotificationChannels.NETWORK_STATUS); mTetheredNotificationBuilder = new Notification.Builder(mContext, channel.getId()); mTetheredNotificationBuilder.setWhen(0) .setOngoing(true) .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)) android.R.color.system_notification_accent_color)) .setVisibility(Notification.VISIBILITY_PUBLIC) .setCategory(Notification.CATEGORY_STATUS); } Loading Loading
packages/Tethering/res/values/strings.xml +19 −2 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2020 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. --> <resources> <!-- Shown when the device is tethered --> <!-- Strings for tethered notification title [CHAR LIMIT=200] --> Loading @@ -13,4 +27,7 @@ <string name="disable_tether_notification_title">Tethering is disabled</string> <!-- Strings for tether disabling notification message [CHAR LIMIT=200] --> <string name="disable_tether_notification_message">Contact your admin for details</string> <!-- Strings for tether notification channel name [CHAR LIMIT=200] --> <string name="notification_channel_tethering_status">Hotspot & tethering status</string> </resources> No newline at end of file
packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java +9 −4 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import static android.telephony.CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANG import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -107,7 +108,6 @@ import androidx.annotation.Nullable; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.internal.notification.SystemNotificationChannels; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.MessageUtils; import com.android.internal.util.State; Loading Loading @@ -692,6 +692,12 @@ public class Tethering { if (notificationManager == null) { return; } final NotificationChannel channel = new NotificationChannel( "TETHERING_STATUS", mContext.getResources().getString(R.string.notification_channel_tethering_status), NotificationManager.IMPORTANCE_LOW); notificationManager.createNotificationChannel(channel); int icon = 0; switch(id) { case SystemMessage.NOTE_TETHER_USB: Loading Loading @@ -735,12 +741,11 @@ public class Tethering { } if (mTetheredNotificationBuilder == null) { mTetheredNotificationBuilder = new Notification.Builder(mContext, SystemNotificationChannels.NETWORK_STATUS); mTetheredNotificationBuilder = new Notification.Builder(mContext, channel.getId()); mTetheredNotificationBuilder.setWhen(0) .setOngoing(true) .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)) android.R.color.system_notification_accent_color)) .setVisibility(Notification.VISIBILITY_PUBLIC) .setCategory(Notification.CATEGORY_STATUS); } Loading