Revert "Clean up unused WifiManager.ActionListener"
This reverts commit a2adee5362
.
Reason for revert: Breaks build - b/294364808
Change-Id: I4f323c2fc43dddbf2f2dd0e323f026727263c99e
This commit is contained in:
committed by
Android (Google) Code Review
parent
a2adee5362
commit
c4a0abef8c
@@ -1953,6 +1953,8 @@
|
|||||||
<string name="wifi_forget">Forget</string>
|
<string name="wifi_forget">Forget</string>
|
||||||
<!-- Button label to modify a Wi-Fi network -->
|
<!-- Button label to modify a Wi-Fi network -->
|
||||||
<string name="wifi_modify">Modify</string>
|
<string name="wifi_modify">Modify</string>
|
||||||
|
<!-- Failured notification for forget -->
|
||||||
|
<string name="wifi_failed_forget_message">Failed to forget network</string>
|
||||||
<!-- Button label to save a Wi-Fi network configuration -->
|
<!-- Button label to save a Wi-Fi network configuration -->
|
||||||
<string name="wifi_save">Save</string>
|
<string name="wifi_save">Save</string>
|
||||||
<!-- Failured notification for save -->
|
<!-- Failured notification for save -->
|
||||||
|
@@ -74,6 +74,7 @@ import com.android.settings.wifi.ConfigureWifiEntryFragment;
|
|||||||
import com.android.settings.wifi.ConnectedWifiEntryPreference;
|
import com.android.settings.wifi.ConnectedWifiEntryPreference;
|
||||||
import com.android.settings.wifi.LongPressWifiEntryPreference;
|
import com.android.settings.wifi.LongPressWifiEntryPreference;
|
||||||
import com.android.settings.wifi.WifiConfigUiBase2;
|
import com.android.settings.wifi.WifiConfigUiBase2;
|
||||||
|
import com.android.settings.wifi.WifiConnectListener;
|
||||||
import com.android.settings.wifi.WifiDialog2;
|
import com.android.settings.wifi.WifiDialog2;
|
||||||
import com.android.settings.wifi.WifiPickerTrackerHelper;
|
import com.android.settings.wifi.WifiPickerTrackerHelper;
|
||||||
import com.android.settings.wifi.WifiUtils;
|
import com.android.settings.wifi.WifiUtils;
|
||||||
@@ -198,7 +199,9 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected WifiManager mWifiManager;
|
protected WifiManager mWifiManager;
|
||||||
|
private WifiManager.ActionListener mConnectListener;
|
||||||
private WifiManager.ActionListener mSaveListener;
|
private WifiManager.ActionListener mSaveListener;
|
||||||
|
private WifiManager.ActionListener mForgetListener;
|
||||||
|
|
||||||
protected InternetResetHelper mInternetResetHelper;
|
protected InternetResetHelper mInternetResetHelper;
|
||||||
|
|
||||||
@@ -404,6 +407,8 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
mInternetUpdater = new InternetUpdater(getContext(), getSettingsLifecycle(), this);
|
mInternetUpdater = new InternetUpdater(getContext(), getSettingsLifecycle(), this);
|
||||||
|
|
||||||
|
mConnectListener = new WifiConnectListener(getActivity());
|
||||||
|
|
||||||
mSaveListener = new WifiManager.ActionListener() {
|
mSaveListener = new WifiManager.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@@ -419,6 +424,22 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mForgetListener = new WifiManager.ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(int reason) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
Toast.makeText(activity,
|
||||||
|
R.string.wifi_failed_forget_message,
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
|
48
src/com/android/settings/wifi/WifiConnectListener.java
Normal file
48
src/com/android/settings/wifi/WifiConnectListener.java
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.wifi;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A listener to display a toast on failure to connect
|
||||||
|
*/
|
||||||
|
public class WifiConnectListener implements WifiManager.ActionListener {
|
||||||
|
|
||||||
|
private final Context mContext;
|
||||||
|
|
||||||
|
public WifiConnectListener(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(int reason) {
|
||||||
|
if (mContext != null) {
|
||||||
|
Toast.makeText(mContext,
|
||||||
|
R.string.wifi_failed_connect_message,
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -59,6 +59,7 @@ import com.android.settings.LinkifyUtils;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.RestrictedSettingsFragment;
|
import com.android.settings.RestrictedSettingsFragment;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.FeatureFlags;
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settings.datausage.DataUsagePreference;
|
import com.android.settings.datausage.DataUsagePreference;
|
||||||
@@ -174,7 +175,9 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected WifiManager mWifiManager;
|
protected WifiManager mWifiManager;
|
||||||
|
private WifiManager.ActionListener mConnectListener;
|
||||||
private WifiManager.ActionListener mSaveListener;
|
private WifiManager.ActionListener mSaveListener;
|
||||||
|
private WifiManager.ActionListener mForgetListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The state of {@link #isUiRestricted()} at {@link #onCreate(Bundle)}}. This is neccesary to
|
* The state of {@link #isUiRestricted()} at {@link #onCreate(Bundle)}}. This is neccesary to
|
||||||
@@ -307,6 +310,8 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
mWifiManager = getActivity().getSystemService(WifiManager.class);
|
mWifiManager = getActivity().getSystemService(WifiManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mConnectListener = new WifiConnectListener(getActivity());
|
||||||
|
|
||||||
mSaveListener = new WifiManager.ActionListener() {
|
mSaveListener = new WifiManager.ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
@@ -323,6 +328,21 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mForgetListener = new WifiManager.ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(int reason) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
Toast.makeText(activity,
|
||||||
|
R.string.wifi_failed_forget_message,
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
registerForContextMenu(getListView());
|
registerForContextMenu(getListView());
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user