Loading core/java/com/android/internal/app/HarmfulAppWarningActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.app; import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; Loading @@ -27,6 +29,7 @@ import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; import com.android.internal.R; /** Loading @@ -48,6 +51,7 @@ public class HarmfulAppWarningActivity extends AlertActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); final Intent intent = getIntent(); mPackageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME); mTarget = intent.getParcelableExtra(Intent.EXTRA_INTENT); Loading services/core/java/com/android/server/notification/PreferencesHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,9 @@ public class PreferencesHelper implements RankingConfig { if (r == null) { throw new IllegalArgumentException("Invalid package"); } if (fromTargetApp) { group.setBlocked(false); } final NotificationChannelGroup oldGroup = r.groups.get(group.getId()); if (!group.equals(oldGroup)) { // will log for new entries as well as name/description changes Loading services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -2009,6 +2009,19 @@ public class PreferencesHelperTest extends UiServiceTestCase { assertTrue(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); } @Test public void testIsGroupBlocked_appCannotCreateAsBlocked() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); group.setBlocked(true); mHelper.createNotificationChannelGroup(PKG_N_MR1, UID_N_MR1, group, true); assertFalse(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); NotificationChannelGroup group3 = group.clone(); group3.setBlocked(false); mHelper.createNotificationChannelGroup(PKG_N_MR1, UID_N_MR1, group3, true); assertFalse(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); } @Test public void testIsGroup_appCannotResetBlock() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); Loading Loading
core/java/com/android/internal/app/HarmfulAppWarningActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.app; import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; Loading @@ -27,6 +29,7 @@ import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; import com.android.internal.R; /** Loading @@ -48,6 +51,7 @@ public class HarmfulAppWarningActivity extends AlertActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS); final Intent intent = getIntent(); mPackageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME); mTarget = intent.getParcelableExtra(Intent.EXTRA_INTENT); Loading
services/core/java/com/android/server/notification/PreferencesHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,9 @@ public class PreferencesHelper implements RankingConfig { if (r == null) { throw new IllegalArgumentException("Invalid package"); } if (fromTargetApp) { group.setBlocked(false); } final NotificationChannelGroup oldGroup = r.groups.get(group.getId()); if (!group.equals(oldGroup)) { // will log for new entries as well as name/description changes Loading
services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -2009,6 +2009,19 @@ public class PreferencesHelperTest extends UiServiceTestCase { assertTrue(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); } @Test public void testIsGroupBlocked_appCannotCreateAsBlocked() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); group.setBlocked(true); mHelper.createNotificationChannelGroup(PKG_N_MR1, UID_N_MR1, group, true); assertFalse(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); NotificationChannelGroup group3 = group.clone(); group3.setBlocked(false); mHelper.createNotificationChannelGroup(PKG_N_MR1, UID_N_MR1, group3, true); assertFalse(mHelper.isGroupBlocked(PKG_N_MR1, UID_N_MR1, group.getId())); } @Test public void testIsGroup_appCannotResetBlock() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); Loading