Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2553,4 +2553,7 @@ <item>110,119:112</item> --> <string-array translatable="false" name="config_convert_to_emergency_number_map" /> <!-- An array of packages for which notifications cannot be blocked. --> <string-array translatable="false" name="config_nonBlockableNotificationPackages" /> </resources> core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2701,4 +2701,6 @@ <java-symbol type="drawable" name="ic_restart" /> <java-symbol type="array" name="config_convert_to_emergency_number_map" /> <java-symbol type="array" name="config_nonBlockableNotificationPackages" /> </resources> packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +10 −1 Original line number Diff line number Diff line Loading @@ -113,8 +113,11 @@ import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.StackStateAnimator; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; import static android.service.notification.NotificationListenerService.Ranking.IMPORTANCE_HIGH; Loading Loading @@ -268,6 +271,8 @@ public abstract class BaseStatusBar extends SystemUI implements protected boolean mVrMode; private Set<String> mNonBlockablePkgs; @Override // NotificationData.Environment public boolean isDeviceProvisioned() { return mDeviceProvisioned; Loading Loading @@ -824,6 +829,9 @@ public abstract class BaseStatusBar extends SystemUI implements Slog.e(TAG, "Failed to register VR mode state listener: " + e); } mNonBlockablePkgs = new HashSet<String>(); Collections.addAll(mNonBlockablePkgs, mContext.getResources().getStringArray( com.android.internal.R.array.config_nonBlockableNotificationPackages)); } protected void notifyUserAboutHiddenNotifications() { Loading Loading @@ -1104,7 +1112,8 @@ public abstract class BaseStatusBar extends SystemUI implements settingsButton.setVisibility(View.GONE); } guts.bindImportance(pmUser, sbn, mNotificationData.getImportance(sbn.getKey())); guts.bindImportance(pmUser, sbn, mNonBlockablePkgs, mNotificationData.getImportance(sbn.getKey())); final TextView doneButton = (TextView) guts.findViewById(R.id.done); doneButton.setText(R.string.notification_done); Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java +14 −10 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ import com.android.systemui.R; import com.android.systemui.statusbar.stack.StackStateAnimator; import com.android.systemui.tuner.TunerService; import java.util.Set; /** * The guts of a notification revealed when performing a long press. */ Loading Loading @@ -173,7 +175,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab } void bindImportance(final PackageManager pm, final StatusBarNotification sbn, final int importance) { final Set<String> nonBlockablePkgs, final int importance) { mINotificationManager = INotificationManager.Stub.asInterface( ServiceManager.getService(Context.NOTIFICATION_SERVICE)); mStartingUserImportance = NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED; Loading @@ -182,24 +184,26 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab mINotificationManager.getImportance(sbn.getPackageName(), sbn.getUid()); } catch (RemoteException e) {} mNotificationImportance = importance; boolean systemApp = false; boolean nonBlockable = false; try { final PackageInfo info = pm.getPackageInfo(sbn.getPackageName(), PackageManager.GET_SIGNATURES); systemApp = Utils.isSystemPackage(getResources(), pm, info); 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, systemApp); bindSlider(importanceSlider, nonBlockable); importanceSlider.setVisibility(View.VISIBLE); importanceButtons.setVisibility(View.GONE); } else { bindToggles(importanceButtons, mStartingUserImportance, systemApp); bindToggles(importanceButtons, mStartingUserImportance, nonBlockable); importanceButtons.setVisibility(View.VISIBLE); importanceSlider.setVisibility(View.GONE); } Loading Loading @@ -239,7 +243,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab } private void bindToggles(final View importanceButtons, final int importance, final boolean systemApp) { final boolean nonBlockable) { ((RadioGroup) importanceButtons).setOnCheckedChangeListener( new RadioGroup.OnCheckedChangeListener() { @Override Loading @@ -250,7 +254,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab mBlock = (RadioButton) importanceButtons.findViewById(R.id.block_importance); mSilent = (RadioButton) importanceButtons.findViewById(R.id.silent_importance); mReset = (RadioButton) importanceButtons.findViewById(R.id.reset_importance); if (systemApp) { if (nonBlockable) { mBlock.setVisibility(View.GONE); mReset.setText(mContext.getString(R.string.do_not_silence)); } else { Loading @@ -265,7 +269,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab } } private void bindSlider(final View importanceSlider, final boolean systemApp) { private void bindSlider(final View importanceSlider, final boolean nonBlockable) { mActiveSliderTint = ColorStateList.valueOf(Utils.getColorAccent(mContext)); mInactiveSliderTint = loadColorStateList(R.color.notification_guts_disabled_slider_color); Loading @@ -273,7 +277,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab mImportanceTitle = ((TextView) importanceSlider.findViewById(R.id.title)); mSeekBar = (SeekBar) importanceSlider.findViewById(R.id.seekbar); final int minProgress = systemApp ? final int minProgress = nonBlockable ? NotificationListenerService.Ranking.IMPORTANCE_MIN : NotificationListenerService.Ranking.IMPORTANCE_NONE; mSeekBar.setMax(NotificationListenerService.Ranking.IMPORTANCE_MAX); Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2553,4 +2553,7 @@ <item>110,119:112</item> --> <string-array translatable="false" name="config_convert_to_emergency_number_map" /> <!-- An array of packages for which notifications cannot be blocked. --> <string-array translatable="false" name="config_nonBlockableNotificationPackages" /> </resources>
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2701,4 +2701,6 @@ <java-symbol type="drawable" name="ic_restart" /> <java-symbol type="array" name="config_convert_to_emergency_number_map" /> <java-symbol type="array" name="config_nonBlockableNotificationPackages" /> </resources>
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +10 −1 Original line number Diff line number Diff line Loading @@ -113,8 +113,11 @@ import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.StackStateAnimator; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; import static android.service.notification.NotificationListenerService.Ranking.IMPORTANCE_HIGH; Loading Loading @@ -268,6 +271,8 @@ public abstract class BaseStatusBar extends SystemUI implements protected boolean mVrMode; private Set<String> mNonBlockablePkgs; @Override // NotificationData.Environment public boolean isDeviceProvisioned() { return mDeviceProvisioned; Loading Loading @@ -824,6 +829,9 @@ public abstract class BaseStatusBar extends SystemUI implements Slog.e(TAG, "Failed to register VR mode state listener: " + e); } mNonBlockablePkgs = new HashSet<String>(); Collections.addAll(mNonBlockablePkgs, mContext.getResources().getStringArray( com.android.internal.R.array.config_nonBlockableNotificationPackages)); } protected void notifyUserAboutHiddenNotifications() { Loading Loading @@ -1104,7 +1112,8 @@ public abstract class BaseStatusBar extends SystemUI implements settingsButton.setVisibility(View.GONE); } guts.bindImportance(pmUser, sbn, mNotificationData.getImportance(sbn.getKey())); guts.bindImportance(pmUser, sbn, mNonBlockablePkgs, mNotificationData.getImportance(sbn.getKey())); final TextView doneButton = (TextView) guts.findViewById(R.id.done); doneButton.setText(R.string.notification_done); Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java +14 −10 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ import com.android.systemui.R; import com.android.systemui.statusbar.stack.StackStateAnimator; import com.android.systemui.tuner.TunerService; import java.util.Set; /** * The guts of a notification revealed when performing a long press. */ Loading Loading @@ -173,7 +175,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab } void bindImportance(final PackageManager pm, final StatusBarNotification sbn, final int importance) { final Set<String> nonBlockablePkgs, final int importance) { mINotificationManager = INotificationManager.Stub.asInterface( ServiceManager.getService(Context.NOTIFICATION_SERVICE)); mStartingUserImportance = NotificationListenerService.Ranking.IMPORTANCE_UNSPECIFIED; Loading @@ -182,24 +184,26 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab mINotificationManager.getImportance(sbn.getPackageName(), sbn.getUid()); } catch (RemoteException e) {} mNotificationImportance = importance; boolean systemApp = false; boolean nonBlockable = false; try { final PackageInfo info = pm.getPackageInfo(sbn.getPackageName(), PackageManager.GET_SIGNATURES); systemApp = Utils.isSystemPackage(getResources(), pm, info); 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, systemApp); bindSlider(importanceSlider, nonBlockable); importanceSlider.setVisibility(View.VISIBLE); importanceButtons.setVisibility(View.GONE); } else { bindToggles(importanceButtons, mStartingUserImportance, systemApp); bindToggles(importanceButtons, mStartingUserImportance, nonBlockable); importanceButtons.setVisibility(View.VISIBLE); importanceSlider.setVisibility(View.GONE); } Loading Loading @@ -239,7 +243,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab } private void bindToggles(final View importanceButtons, final int importance, final boolean systemApp) { final boolean nonBlockable) { ((RadioGroup) importanceButtons).setOnCheckedChangeListener( new RadioGroup.OnCheckedChangeListener() { @Override Loading @@ -250,7 +254,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab mBlock = (RadioButton) importanceButtons.findViewById(R.id.block_importance); mSilent = (RadioButton) importanceButtons.findViewById(R.id.silent_importance); mReset = (RadioButton) importanceButtons.findViewById(R.id.reset_importance); if (systemApp) { if (nonBlockable) { mBlock.setVisibility(View.GONE); mReset.setText(mContext.getString(R.string.do_not_silence)); } else { Loading @@ -265,7 +269,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab } } private void bindSlider(final View importanceSlider, final boolean systemApp) { private void bindSlider(final View importanceSlider, final boolean nonBlockable) { mActiveSliderTint = ColorStateList.valueOf(Utils.getColorAccent(mContext)); mInactiveSliderTint = loadColorStateList(R.color.notification_guts_disabled_slider_color); Loading @@ -273,7 +277,7 @@ public class NotificationGuts extends LinearLayout implements TunerService.Tunab mImportanceTitle = ((TextView) importanceSlider.findViewById(R.id.title)); mSeekBar = (SeekBar) importanceSlider.findViewById(R.id.seekbar); final int minProgress = systemApp ? final int minProgress = nonBlockable ? NotificationListenerService.Ranking.IMPORTANCE_MIN : NotificationListenerService.Ranking.IMPORTANCE_NONE; mSeekBar.setMax(NotificationListenerService.Ranking.IMPORTANCE_MAX); Loading