Control UI behavior according to different Wi-Fi DPP intents.
When it's a configurator from Settings, the cancel button of WifiDppChooseSavedWifiNetworkFragment should pop back stack. When it's a configurator from a camera app, the cancel button of WifiDppChooseSavedWifiNetworkFragment should finish host activity. Bug: 120517242 Test: manual test Change-Id: Ia0fb0daf16c94ecd62aa6d357405fcd529935d2f
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.settings.wifi.dpp;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -83,9 +84,20 @@ public class WifiDppChooseSavedWifiNetworkFragment extends WifiDppQrCodeBaseFrag
|
||||
mButtonLeft = view.findViewById(R.id.button_left);
|
||||
mButtonLeft.setText(R.string.cancel);
|
||||
mButtonLeft.setOnClickListener(v -> {
|
||||
Activity activity = getActivity();
|
||||
activity.setResult(Activity.RESULT_CANCELED);
|
||||
activity.finish();
|
||||
String action = null;
|
||||
final Intent intent = getActivity().getIntent();
|
||||
if (intent != null) {
|
||||
action = intent.getAction();
|
||||
}
|
||||
if (WifiDppConfiguratorActivity.ACTION_CONFIGURATOR_QR_CODE_SCANNER.equals(action) ||
|
||||
WifiDppConfiguratorActivity
|
||||
.ACTION_CONFIGURATOR_QR_CODE_GENERATOR.equals(action)) {
|
||||
getFragmentManager().popBackStack();
|
||||
} else {
|
||||
final Activity activity = getActivity();
|
||||
activity.setResult(Activity.RESULT_CANCELED);
|
||||
activity.finish();
|
||||
}
|
||||
});
|
||||
|
||||
mButtonRight = view.findViewById(R.id.button_right);
|
||||
|
Reference in New Issue
Block a user