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