Merge "Use hasSentValidBubble in settings"
This commit is contained in:
@@ -361,6 +361,15 @@ public class NotificationBackend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasSentValidBubble(String pkg, int uid) {
|
||||||
|
try {
|
||||||
|
return sINM.hasSentValidBubble(pkg, uid);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "Error calling NoMan", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all notification channels associated with the package and uid that will bypass DND
|
* Returns all notification channels associated with the package and uid that will bypass DND
|
||||||
*/
|
*/
|
||||||
|
@@ -63,7 +63,7 @@ public class BubbleSummaryPreferenceController extends NotificationPreferenceCon
|
|||||||
return mAppRow != null;
|
return mAppRow != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isGloballyEnabled() && mBackend.hasSentValidMsg(mAppRow.pkg, mAppRow.uid);
|
return isGloballyEnabled() && mBackend.hasSentValidBubble(mAppRow.pkg, mAppRow.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -73,7 +73,7 @@ public class BubbleSummaryPreferenceControllerTest {
|
|||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
ShadowApplication shadowApplication = ShadowApplication.getInstance();
|
ShadowApplication shadowApplication = ShadowApplication.getInstance();
|
||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
when(mBackend.hasSentValidMsg(anyString(), anyInt())).thenReturn(true);
|
when(mBackend.hasSentValidBubble(anyString(), anyInt())).thenReturn(true);
|
||||||
mAppRow = new NotificationBackend.AppRow();
|
mAppRow = new NotificationBackend.AppRow();
|
||||||
mAppRow.pkg = "pkg";
|
mAppRow.pkg = "pkg";
|
||||||
mAppRow.uid = 0;
|
mAppRow.uid = 0;
|
||||||
@@ -103,10 +103,10 @@ public class BubbleSummaryPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isAvailable_NOTIFICATION_BUBBLESisOn_neverSentMsg_shouldReturnFalse() {
|
public void isAvailable_NOTIFICATION_BUBBLESisOn_neverSentBubble_shouldReturnFalse() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
mController.onResume(mAppRow, null, null, null, null, null, null);
|
mController.onResume(mAppRow, null, null, null, null, null, null);
|
||||||
when(mBackend.hasSentValidMsg(anyString(), anyInt())).thenReturn(false);
|
when(mBackend.hasSentValidBubble(anyString(), anyInt())).thenReturn(false);
|
||||||
|
|
||||||
assertFalse(mController.isAvailable());
|
assertFalse(mController.isAvailable());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user