Essential packages' notifications can no longer be silenced.
am: 028a60f003
Change-Id: Ic3e80d30c99e448c7719d5d40c9e957df94a6af6
This commit is contained in:
@@ -91,6 +91,16 @@
|
||||
style="@style/TextAppearance.NotificationGuts.Radio"
|
||||
android:buttonTint="@color/notification_guts_buttons" />
|
||||
</RadioGroup>
|
||||
<!-- When neither blocking or silencing is available -->
|
||||
<TextView
|
||||
android:id="@+id/cant_silence_or_block"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/TextAppearance.NotificationGuts.Radio"
|
||||
android:text="@string/cant_silence_or_block"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<!-- Importance slider -->
|
||||
<LinearLayout
|
||||
android:id="@+id/importance_slider"
|
||||
|
||||
@@ -1666,7 +1666,10 @@
|
||||
<!-- accessibility label for button to edit quick settings [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_quick_settings_edit">Edit order of settings.</string>
|
||||
|
||||
<!-- accessibility label for paging indicator in quick settings [CHAR LIMITi=NONE] -->
|
||||
<!-- accessibility label for paging indicator in quick settings [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_quick_settings_page">Page <xliff:g name="current_page" example="1">%1$d</xliff:g> of <xliff:g name="num_pages" example="2">%2$d</xliff:g></string>
|
||||
|
||||
<!-- Label that replaces other notification controls when the notification is from the system
|
||||
and cannot be silenced (see @string/show_silently) or blocked (see @string/block) -->
|
||||
<string name="cant_silence_or_block">Notifications can\'t be silenced or blocked</string>
|
||||
</resources>
|
||||
|
||||
@@ -829,7 +829,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
Slog.e(TAG, "Failed to register VR mode state listener: " + e);
|
||||
}
|
||||
|
||||
mNonBlockablePkgs = new HashSet<String>();
|
||||
mNonBlockablePkgs = new ArraySet<String>();
|
||||
Collections.addAll(mNonBlockablePkgs, mContext.getResources().getStringArray(
|
||||
com.android.internal.R.array.config_nonBlockableNotificationPackages));
|
||||
}
|
||||
|
||||
@@ -184,28 +184,38 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab
|
||||
mINotificationManager.getImportance(sbn.getPackageName(), sbn.getUid());
|
||||
} catch (RemoteException e) {}
|
||||
mNotificationImportance = importance;
|
||||
boolean nonBlockable = false;
|
||||
try {
|
||||
final PackageInfo info =
|
||||
pm.getPackageInfo(sbn.getPackageName(), PackageManager.GET_SIGNATURES);
|
||||
nonBlockable = Utils.isSystemPackage(getResources(), pm, info);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// unlikely.
|
||||
}
|
||||
if (nonBlockablePkgs != null) {
|
||||
nonBlockable |= nonBlockablePkgs.contains(sbn.getPackageName());
|
||||
}
|
||||
|
||||
final View importanceSlider = findViewById(R.id.importance_slider);
|
||||
final View importanceButtons = findViewById(R.id.importance_buttons);
|
||||
if (mShowSlider) {
|
||||
bindSlider(importanceSlider, nonBlockable);
|
||||
importanceSlider.setVisibility(View.VISIBLE);
|
||||
final View cantTouchThis = findViewById(R.id.cant_silence_or_block);
|
||||
|
||||
final boolean essentialPackage =
|
||||
(nonBlockablePkgs != null && nonBlockablePkgs.contains(sbn.getPackageName()));
|
||||
if (essentialPackage) {
|
||||
importanceButtons.setVisibility(View.GONE);
|
||||
} else {
|
||||
bindToggles(importanceButtons, mStartingUserImportance, nonBlockable);
|
||||
importanceButtons.setVisibility(View.VISIBLE);
|
||||
importanceSlider.setVisibility(View.GONE);
|
||||
cantTouchThis.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
cantTouchThis.setVisibility(View.GONE);
|
||||
|
||||
boolean nonBlockable = false;
|
||||
try {
|
||||
final PackageInfo info =
|
||||
pm.getPackageInfo(sbn.getPackageName(), PackageManager.GET_SIGNATURES);
|
||||
nonBlockable = Utils.isSystemPackage(getResources(), pm, info);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// unlikely.
|
||||
}
|
||||
|
||||
if (mShowSlider) {
|
||||
bindSlider(importanceSlider, nonBlockable);
|
||||
importanceSlider.setVisibility(View.VISIBLE);
|
||||
importanceButtons.setVisibility(View.GONE);
|
||||
} else {
|
||||
bindToggles(importanceButtons, mStartingUserImportance, nonBlockable);
|
||||
importanceButtons.setVisibility(View.VISIBLE);
|
||||
importanceSlider.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user