use of android.os.Build in project Signal-Android by WhisperSystems.
the class Megaphones method buildNotificationsMegaphone.
@NonNull
private static Megaphone buildNotificationsMegaphone(@NonNull Context context) {
return new Megaphone.Builder(Event.NOTIFICATIONS, Megaphone.Style.BASIC).setTitle(R.string.NotificationsMegaphone_turn_on_notifications).setBody(R.string.NotificationsMegaphone_never_miss_a_message).setImage(R.drawable.megaphone_notifications_64).setActionButton(R.string.NotificationsMegaphone_turn_on, (megaphone, controller) -> {
if (Build.VERSION.SDK_INT >= 26 && !NotificationChannels.isMessageChannelEnabled(context)) {
Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_CHANNEL_ID, NotificationChannels.getMessagesChannel(context));
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
controller.onMegaphoneNavigationRequested(intent);
} else if (Build.VERSION.SDK_INT >= 26 && (!NotificationChannels.areNotificationsEnabled(context) || !NotificationChannels.isMessagesChannelGroupEnabled(context))) {
Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
controller.onMegaphoneNavigationRequested(intent);
} else {
controller.onMegaphoneNavigationRequested(AppSettingsActivity.notifications(context));
}
}).setSecondaryButton(R.string.NotificationsMegaphone_not_now, (megaphone, controller) -> controller.onMegaphoneSnooze(Event.NOTIFICATIONS)).build();
}
use of android.os.Build in project robolectric by robolectric.
the class RobolectricTestRunnerTest method shouldReportPerfStats.
@Test
public void shouldReportPerfStats() throws Exception {
List<Metric> metrics = new ArrayList<>();
PerfStatsReporter reporter = (metadata, metrics1) -> metrics.addAll(metrics1);
RobolectricTestRunner runner = new SingleSdkRobolectricTestRunner(TestWithTwoMethods.class, RobolectricTestRunner.defaultInjector().bind(PerfStatsReporter[].class, new PerfStatsReporter[] { reporter }).build());
runner.run(notifier);
Set<String> metricNames = metrics.stream().map(Metric::getName).collect(toSet());
assertThat(metricNames).contains("initialization");
}
use of android.os.Build in project armadillo by patrickfav.
the class SecureSharedPreferencesTest method testSecurePreferenceNotMatching.
@Test
@UiThreadTest
public void testSecurePreferenceNotMatching() {
ArmadilloSharedPreferences armadilloSharedPreferences = create("fingerprint", null).build();
AtomicBoolean matched = new AtomicBoolean(false);
armadilloSharedPreferences.registerOnSecurePreferenceChangeListener(((sharedPreferences, comparison) -> {
if (comparison.isDerivedKeyEqualTo("key-of-interest")) {
matched.set(true);
}
}));
armadilloSharedPreferences.edit().putInt("another-key", 3).commit();
assertFalse(matched.get());
}
use of android.os.Build in project armadillo by patrickfav.
the class SecureSharedPreferencesTest method testSecurePreferenceChangeNotification.
@Test
@UiThreadTest
public void testSecurePreferenceChangeNotification() {
ArmadilloSharedPreferences armadilloSharedPreferences = create("fingerprint", null).build();
AtomicBoolean matched = new AtomicBoolean(false);
armadilloSharedPreferences.registerOnSecurePreferenceChangeListener(((sharedPreferences, comparison) -> {
if (comparison.isDerivedKeyEqualTo("key-of-interest")) {
matched.set(true);
}
}));
armadilloSharedPreferences.edit().putInt("key-of-interest", 3).commit();
assertTrue(matched.get());
}
use of android.os.Build in project incubator-weex by apache.
the class WXSoInstallMgrSdk method _cpuType.
private static String _cpuType() {
String abi = _getFieldReflectively(new Build(), "CPU_ABI");
if (abi == null || abi.length() == 0 || abi.equals("Unknown")) {
abi = ARMEABI;
}
abi = abi.toLowerCase();
return abi;
}
Aggregations