- Refresh slice in WifiTracker.onConnectedChanged
- Only expose notifySliceChange to child in SliceBackgroundWorker
Fixes:
123270015
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.wifi.slice
Change-Id: Id5540ebae2746e58e14924665c5e62bf437ebcf0
private static final String TAG = "BluetoothUpdateWorker";
- private final Context mContext;
- private final Uri mUri;
private final LocalBluetoothManager mLocalBluetoothManager;
public BluetoothUpdateWorker(Context context, Uri uri) {
super(context, uri);
-
- mContext = context;
- mUri = uri;
- mLocalBluetoothManager = Utils.getLocalBtManager(mContext);
+ mLocalBluetoothManager = Utils.getLocalBtManager(context);
}
@Override
int bluetoothProfile) {
notifySliceChange();
}
-
- private void notifySliceChange() {
- mContext.getContentResolver().notifyChange(mUri, null);
- }
}
\ No newline at end of file
mUri = uri;
}
- protected Uri getUri() {
- return mUri;
- }
-
/**
* Returns the singleton instance of the {@link SliceBackgroundWorker} for specified {@link Uri}
* if exists
if (needNotify) {
mCachedResults = results;
- mContext.getContentResolver().notifyChange(mUri, null);
+ notifySliceChange();
}
}
-}
+
+ /**
+ * Notify that data was updated and attempt to sync changes to the Slice.
+ */
+ protected void notifySliceChange() {
+ mContext.getContentResolver().notifyChange(mUri, null);
+ }
+}
\ No newline at end of file
@Override
public void onWifiStateChanged(int state) {
- mContext.getContentResolver().notifyChange(getUri(), null);
+ notifySliceChange();
}
@Override
public void onConnectedChanged() {
+ notifySliceChange();
}
@Override
verify(mResolver).notifyChange(WIFI_SLICE_URI, null);
}
+
+ @Test
+ public void onConnectedChanged_shouldNotifyChange() {
+ mWifiScanWorker.onConnectedChanged();
+
+ verify(mResolver).notifyChange(WIFI_SLICE_URI, null);
+ }
}