Merge "Fix NPE for CompanionDeviceActivity.setResultAndFinish()" into sc-v2-dev am: efea2ad2d9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16214942 Change-Id: I1baa7c9ac5cc0f9fff5d195f836a2562801f48bb
This commit is contained in:
commit
79ecb086fd
@ -78,6 +78,7 @@ public class CompanionDeviceActivity extends Activity {
|
||||
|
||||
getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
|
||||
sInstance = this;
|
||||
getService().mActivity = this;
|
||||
|
||||
String deviceProfile = getRequest().getDeviceProfile();
|
||||
String profilePrivacyDisclaimer = emptyIfNull(getRequest()
|
||||
@ -141,8 +142,6 @@ public class CompanionDeviceActivity extends Activity {
|
||||
profileSummary.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
getService().mActivity = this;
|
||||
|
||||
mCancelButton = findViewById(R.id.button_cancel);
|
||||
mCancelButton.setOnClickListener(v -> cancel());
|
||||
}
|
||||
@ -194,6 +193,7 @@ public class CompanionDeviceActivity extends Activity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getService().mActivity = null;
|
||||
if (sInstance == this) {
|
||||
sInstance = null;
|
||||
}
|
||||
|
@ -258,12 +258,8 @@ public class CompanionDeviceDiscoveryService extends Service {
|
||||
if (!mIsScanning) return;
|
||||
mIsScanning = false;
|
||||
|
||||
CompanionDeviceActivity activity = mActivity;
|
||||
if (activity != null) {
|
||||
if (activity.mDeviceListView != null) {
|
||||
activity.mDeviceListView.removeFooterView(activity.mLoadingIndicator);
|
||||
}
|
||||
mActivity = null;
|
||||
if (mActivity != null && mActivity.mDeviceListView != null) {
|
||||
mActivity.mDeviceListView.removeFooterView(mActivity.mLoadingIndicator);
|
||||
}
|
||||
|
||||
mBluetoothAdapter.cancelDiscovery();
|
||||
@ -337,6 +333,7 @@ public class CompanionDeviceDiscoveryService extends Service {
|
||||
|
||||
void onCancel() {
|
||||
if (DEBUG) Log.i(LOG_TAG, "onCancel()");
|
||||
mActivity = null;
|
||||
mServiceCallback.cancel(true);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user