@Test @SmallTest public void testGetInitialState_storageLowIntent() { mockContextReturns(new Intent(Intent.ACTION_DEVICE_STORAGE_LOW)); assertThat(mTracker.getInitialState(), is(false)); }
@Override public Boolean getInitialState() { Intent intent = mAppContext.registerReceiver(null, getIntentFilter()); if (intent == null || intent.getAction() == null) { return true; } else { switch (intent.getAction()) { case Intent.ACTION_DEVICE_STORAGE_OK: return true; case Intent.ACTION_DEVICE_STORAGE_LOW: return false; default: return null; } } }
StorageNotLowTracker extends BroadcastReceiverConstraintTracker<Boolean> { @Override public Boolean getInitialState() { Intent intent = mAppContext.registerReceiver(null, getIntentFilter()); if (intent == null || intent.getAction() == null) { return true; } else { switch (intent.getAction()) { case Intent.ACTION_DEVICE_STORAGE_OK: return true; case Intent.ACTION_DEVICE_STORAGE_LOW: return false; default: return null; } } } }
StorageNotLowTracker extends BroadcastReceiverConstraintTracker<Boolean> { @Override public Boolean getInitialState() { Intent intent = mAppContext.registerReceiver(null, getIntentFilter()); if (intent == null || intent.getAction() == null) { return true; } else { switch (intent.getAction()) { case Intent.ACTION_DEVICE_STORAGE_OK: return true; case Intent.ACTION_DEVICE_STORAGE_LOW: return false; default: return null; } } } StorageNotLowTracker(Context context); }
StorageNotLowTracker extends BroadcastReceiverConstraintTracker<Boolean> { @Override public Boolean getInitialState() { Intent intent = mAppContext.registerReceiver(null, getIntentFilter()); if (intent == null || intent.getAction() == null) { return true; } else { switch (intent.getAction()) { case Intent.ACTION_DEVICE_STORAGE_OK: return true; case Intent.ACTION_DEVICE_STORAGE_LOW: return false; default: return null; } } } StorageNotLowTracker(Context context); @Override Boolean getInitialState(); @Override IntentFilter getIntentFilter(); @Override void onBroadcastReceive(Context context, @NonNull Intent intent); }
StorageNotLowTracker extends BroadcastReceiverConstraintTracker<Boolean> { @Override public Boolean getInitialState() { Intent intent = mAppContext.registerReceiver(null, getIntentFilter()); if (intent == null || intent.getAction() == null) { return true; } else { switch (intent.getAction()) { case Intent.ACTION_DEVICE_STORAGE_OK: return true; case Intent.ACTION_DEVICE_STORAGE_LOW: return false; default: return null; } } } StorageNotLowTracker(Context context); @Override Boolean getInitialState(); @Override IntentFilter getIntentFilter(); @Override void onBroadcastReceive(Context context, @NonNull Intent intent);  }