auto import from //branches/cupcake_rel/...@138607
This commit is contained in:
@@ -481,15 +481,8 @@ public class ChooseLockPattern extends Activity implements View.OnClickListener{
|
||||
}
|
||||
|
||||
private void saveChosenPatternAndFinish() {
|
||||
boolean patternExistedBefore = mLockPatternUtils.savedPatternExists();
|
||||
mLockPatternUtils.saveLockPattern(mChosenPattern);
|
||||
|
||||
// if setting pattern for first time, enable the lock gesture. otherwise,
|
||||
// keep the user's setting.
|
||||
if (!patternExistedBefore) {
|
||||
mLockPatternUtils.setLockPatternEnabled(true);
|
||||
mLockPatternUtils.setVisiblePatternEnabled(true);
|
||||
}
|
||||
mLockPatternUtils.setLockPatternEnabled(true);
|
||||
|
||||
setResult(RESULT_FINISHED);
|
||||
finish();
|
||||
|
@@ -34,7 +34,7 @@ public class ChooseLockPatternTutorial extends Activity implements View.OnClickL
|
||||
super.onCreate(savedInstanceState);
|
||||
// Don't show the tutorial if the user has seen it before.
|
||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(getContentResolver());
|
||||
if (savedInstanceState == null && lockPatternUtils.savedPatternExists()) {
|
||||
if (savedInstanceState == null && lockPatternUtils.isPatternEverChosen()) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", "com.android.settings.ChooseLockPattern");
|
||||
startActivity(intent);
|
||||
|
@@ -171,7 +171,10 @@ public class DateTimeSettings
|
||||
SystemClock.setCurrentTimeMillis(when);
|
||||
}
|
||||
updateTimeAndDateDisplay();
|
||||
timeUpdated();
|
||||
|
||||
// We don't need to call timeUpdated() here because the TIME_CHANGED
|
||||
// broadcast is sent by the AlarmManager as a side effect of setting the
|
||||
// SystemClock time.
|
||||
}
|
||||
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||
|
@@ -53,7 +53,7 @@ public class LauncherAppWidgetBinder extends Activity {
|
||||
static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE_FAVORITES);
|
||||
|
||||
static final String ITEM_TYPE = "itemType";
|
||||
static final String APPWIDGET_ID = "gadgetId";
|
||||
static final String APPWIDGET_ID = "appWidgetId";
|
||||
static final String ICON = "icon";
|
||||
|
||||
static final int ITEM_TYPE_APPWIDGET = 4;
|
||||
|
@@ -248,6 +248,38 @@ public class ManageApplications extends ListActivity implements
|
||||
switch (msg.what) {
|
||||
case INIT_PKG_INFO:
|
||||
if(localLOGV) Log.i(TAG, "Message INIT_PKG_INFO");
|
||||
if (!mJustCreated) {
|
||||
// Add or delete newly created packages by comparing lists
|
||||
List<ApplicationInfo> newList = getInstalledApps(FILTER_APPS_ALL);
|
||||
int oldCount = mAppPropCache.size();
|
||||
boolean idxArr[] = new boolean[oldCount];
|
||||
for ( int i = 0; i < oldCount; i++) {
|
||||
idxArr[i] = false;
|
||||
}
|
||||
|
||||
if (newList != null) {
|
||||
for (ApplicationInfo app : newList) {
|
||||
AppInfo aInfo = mAppPropCache.get(app.packageName);
|
||||
if ( aInfo == null) {
|
||||
// New package. post an ADD_PKG message
|
||||
if(localLOGV) Log.i(TAG, "Adding pkg: "+app.packageName);
|
||||
updatePackageList(Intent.ACTION_PACKAGE_ADDED, app.packageName);
|
||||
} else {
|
||||
idxArr[aInfo.index] = true;
|
||||
}
|
||||
}
|
||||
Set<String> keyList = mAppPropCache.keySet();
|
||||
for (String key : keyList) {
|
||||
AppInfo aInfo = mAppPropCache.get(key);
|
||||
int idx = aInfo.index;
|
||||
if (!idxArr[idx]) {
|
||||
String pkg = aInfo.pkgName;
|
||||
if(localLOGV) Log.i(TAG, "Deleting pkg: " + pkg);
|
||||
updatePackageList(Intent.ACTION_PACKAGE_REMOVED, pkg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Retrieve the package list and init some structures
|
||||
initAppList(mFilterApps);
|
||||
mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
|
||||
@@ -499,12 +531,18 @@ public class ManageApplications extends ListActivity implements
|
||||
|
||||
// some initialization code used when kicking off the size computation
|
||||
private void initAppList(int filterOption) {
|
||||
// Initialize lists
|
||||
List<ApplicationInfo> appList = getInstalledApps(filterOption);
|
||||
initAppList(appList, filterOption);
|
||||
}
|
||||
|
||||
// some initialization code used when kicking off the size computation
|
||||
private void initAppList(List<ApplicationInfo> appList, int filterOption) {
|
||||
setProgressBarIndeterminateVisibility(true);
|
||||
mComputeIndex = 0;
|
||||
mComputeSizes = false;
|
||||
mLoadLabels = false;
|
||||
// Initialize lists
|
||||
List<ApplicationInfo> appList = getInstalledApps(filterOption);
|
||||
mAddRemoveMap = new TreeMap<String, Boolean>();
|
||||
mAppInfoAdapter.resetAppList(filterOption, appList);
|
||||
}
|
||||
@@ -860,11 +898,18 @@ public class ManageApplications extends ListActivity implements
|
||||
}
|
||||
return mSizeComparator;
|
||||
}
|
||||
|
||||
public void updateAppsResourceInfo(Map<String, AppInfo> iconMap) {
|
||||
|
||||
/*
|
||||
* This method updates resource information in the package map.
|
||||
*
|
||||
* @param iconMap a map of package names and attributes
|
||||
* @return A boolean value to indicate if the property map has to be
|
||||
* refreshed completely
|
||||
*/
|
||||
public boolean updateAppsResourceInfo(Map<String, AppInfo> iconMap) {
|
||||
if(iconMap == null) {
|
||||
Log.w(TAG, "Null iconMap when refreshing icon in List Adapter");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
boolean changed = false;
|
||||
for (ApplicationInfo info : mAppLocalList) {
|
||||
@@ -874,7 +919,7 @@ public class ManageApplications extends ListActivity implements
|
||||
if (aInfo != null) {
|
||||
aInfo.refreshIcon(pInfo);
|
||||
} else {
|
||||
mAppPropMap.put(info.packageName, pInfo);
|
||||
return false;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
@@ -882,14 +927,56 @@ public class ManageApplications extends ListActivity implements
|
||||
if(changed) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean shouldBeInList(int filterOption, ApplicationInfo info) {
|
||||
// Match filter here
|
||||
boolean addToCurrList = false;
|
||||
if (filterOption == FILTER_APPS_RUNNING) {
|
||||
List<ApplicationInfo> runningList = getInstalledApps(FILTER_APPS_RUNNING);
|
||||
for (ApplicationInfo running : runningList) {
|
||||
if (running.packageName.equalsIgnoreCase(info.packageName)) {
|
||||
addToCurrList = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (filterOption == FILTER_APPS_THIRD_PARTY) {
|
||||
if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
|
||||
addToCurrList = true;
|
||||
} else if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
||||
addToCurrList = true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return addToCurrList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a package to the current list.
|
||||
* The package is only added to the displayed list
|
||||
* based on the filter value. The package is always added to the property map.
|
||||
* @param pkgName name of package to be added
|
||||
* @param ps PackageStats of new package
|
||||
*/
|
||||
public void addToList(String pkgName, PackageStats ps) {
|
||||
if(pkgName == null) {
|
||||
Log.w(TAG, "Adding null pkg to List Adapter");
|
||||
return;
|
||||
}
|
||||
ApplicationInfo info;
|
||||
boolean notInList = true;
|
||||
int newIdx = getIndex(pkgName);
|
||||
if (newIdx != -1) {
|
||||
notInList = false;
|
||||
if (mAppPropMap.get(pkgName) != null) {
|
||||
// weird. just ignore entry
|
||||
Log.i(TAG, "Package:"+pkgName+" already added");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Get ApplicationInfo
|
||||
ApplicationInfo info = null;
|
||||
try {
|
||||
info = mPm.getApplicationInfo(pkgName, 0);
|
||||
} catch (NameNotFoundException e) {
|
||||
@@ -901,21 +988,26 @@ public class ManageApplications extends ListActivity implements
|
||||
Log.i(TAG, "Null ApplicationInfo for package:"+pkgName);
|
||||
return;
|
||||
}
|
||||
// Binary search returns a negative index (ie --index) of the position where
|
||||
// this might be inserted.
|
||||
int newIdx = Collections.binarySearch(mAppLocalList, info,
|
||||
getAppComparator(mSortOrder));
|
||||
if(newIdx >= 0) {
|
||||
Log.i(TAG, "Strange. Package:"+pkgName+" is not new");
|
||||
return;
|
||||
}
|
||||
// New entry
|
||||
newIdx = -newIdx-1;
|
||||
mAppLocalList.add(newIdx, info);
|
||||
mAppPropMap.put(info.packageName, new AppInfo(pkgName, newIdx,
|
||||
// Add entry to map
|
||||
mAppPropMap.put(pkgName, new AppInfo(pkgName, newIdx,
|
||||
info.loadLabel(mPm), info.loadIcon(mPm), ps));
|
||||
adjustIndex();
|
||||
notifyDataSetChanged();
|
||||
// Add to list
|
||||
if (notInList && (shouldBeInList(mFilterApps, info))) {
|
||||
// Binary search returns a negative index (ie -index) of the position where
|
||||
// this might be inserted.
|
||||
newIdx = Collections.binarySearch(mAppLocalList, info,
|
||||
getAppComparator(mSortOrder));
|
||||
if(newIdx >= 0) {
|
||||
Log.i(TAG, "Strange. Package:"+pkgName+" is not new");
|
||||
return;
|
||||
}
|
||||
// New entry
|
||||
newIdx = -newIdx-1;
|
||||
mAppLocalList.add(newIdx, info);
|
||||
// Adjust index
|
||||
adjustIndex();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromList(List<String> pkgNames) {
|
||||
@@ -1134,7 +1226,6 @@ public class ManageApplications extends ListActivity implements
|
||||
List<ApplicationInfo> appList = getInstalledApps(mSortOrder);
|
||||
mAppInfoAdapter = new AppInfoAdapter(this, appList);
|
||||
ListView lv= (ListView) findViewById(android.R.id.list);
|
||||
//lv.setAdapter(mAppInfoAdapter);
|
||||
lv.setOnItemClickListener(this);
|
||||
lv.setSaveEnabled(true);
|
||||
lv.setItemsCanFocus(true);
|
||||
|
@@ -45,8 +45,7 @@ public class SecuritySettings extends PreferenceActivity
|
||||
private static final String KEY_LOCK_ENABLED = "lockenabled";
|
||||
private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
|
||||
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "tactilefeedback";
|
||||
private static final int CONFIRM_PATTERN_THEN_DISABLE_REQUEST_CODE = 55;
|
||||
private static final int CONFIRM_PATTERN_THEN_ENABLE_REQUEST_CODE = 56;
|
||||
private static final int CONFIRM_PATTERN_THEN_DISABLE_AND_CLEAR_REQUEST_CODE = 55;
|
||||
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
private CheckBoxPreference mLockEnabled;
|
||||
@@ -64,7 +63,7 @@ public class SecuritySettings extends PreferenceActivity
|
||||
private CheckBoxPreference mNetwork;
|
||||
private CheckBoxPreference mGps;
|
||||
private LocationManager mLocationManager;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -257,36 +256,26 @@ public class SecuritySettings extends PreferenceActivity
|
||||
|
||||
@Override
|
||||
protected void onClick() {
|
||||
if (mLockPatternUtils.savedPatternExists()) {
|
||||
if (isChecked()) {
|
||||
confirmPatternThenDisable();
|
||||
} else {
|
||||
confirmPatternThenEnable();
|
||||
}
|
||||
if (mLockPatternUtils.savedPatternExists() && isChecked()) {
|
||||
confirmPatternThenDisableAndClear();
|
||||
} else {
|
||||
super.onClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void confirmPatternThenEnable() {
|
||||
final Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", "com.android.settings.ConfirmLockPattern");
|
||||
startActivityForResult(intent, CONFIRM_PATTERN_THEN_ENABLE_REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launch screen to confirm the existing lock pattern.
|
||||
* @see #onActivityResult(int, int, android.content.Intent)
|
||||
*/
|
||||
private void confirmPatternThenDisable() {
|
||||
private void confirmPatternThenDisableAndClear() {
|
||||
final Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", "com.android.settings.ConfirmLockPattern");
|
||||
startActivityForResult(intent, CONFIRM_PATTERN_THEN_DISABLE_REQUEST_CODE);
|
||||
startActivityForResult(intent, CONFIRM_PATTERN_THEN_DISABLE_AND_CLEAR_REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #confirmPatternThenDisable
|
||||
* @see #confirmPatternThenDisableAndClear
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
@@ -295,10 +284,9 @@ public class SecuritySettings extends PreferenceActivity
|
||||
|
||||
final boolean resultOk = resultCode == Activity.RESULT_OK;
|
||||
|
||||
if ((requestCode == CONFIRM_PATTERN_THEN_DISABLE_REQUEST_CODE) && resultOk) {
|
||||
if ((requestCode == CONFIRM_PATTERN_THEN_DISABLE_AND_CLEAR_REQUEST_CODE) && resultOk) {
|
||||
mLockPatternUtils.setLockPatternEnabled(false);
|
||||
} else if ((requestCode == CONFIRM_PATTERN_THEN_ENABLE_REQUEST_CODE) && resultOk) {
|
||||
mLockPatternUtils.setLockPatternEnabled(true);
|
||||
mLockPatternUtils.saveLockPattern(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -168,7 +168,9 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
if (mAnimationScales != null) {
|
||||
for (int i=0; i<mAnimationScales.length; i++) {
|
||||
// We will leave the window animations alone (always set),
|
||||
// and only use this to change the transition animations.
|
||||
for (int i=1; i<mAnimationScales.length; i++) {
|
||||
if (mAnimationScales[i] == 0) {
|
||||
animations = false;
|
||||
break;
|
||||
@@ -224,7 +226,11 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
|
||||
mSoundEffects.isChecked() ? 1 : 0);
|
||||
|
||||
} else if (preference == mAnimations) {
|
||||
for (int i=0; i<mAnimationScales.length; i++) {
|
||||
if (mAnimationScales.length > 0) {
|
||||
// Window animations are always on.
|
||||
mAnimationScales[0] = 1;
|
||||
}
|
||||
for (int i=1; i<mAnimationScales.length; i++) {
|
||||
mAnimationScales[i] = mAnimations.isChecked() ? 1 : 0;
|
||||
}
|
||||
try {
|
||||
|
@@ -46,6 +46,7 @@ public class BluetoothPinDialog extends AlertActivity implements DialogInterface
|
||||
TextWatcher {
|
||||
private static final String TAG = "BluetoothPinDialog";
|
||||
|
||||
private final int BLUETOOTH_PIN_MAX_LENGTH = 16;
|
||||
private LocalBluetoothManager mLocalManager;
|
||||
private String mAddress;
|
||||
private EditText mPinView;
|
||||
@@ -138,8 +139,8 @@ public class BluetoothPinDialog extends AlertActivity implements DialogInterface
|
||||
|
||||
mPinView = (EditText) view.findViewById(R.id.text);
|
||||
mPinView.addTextChangedListener(this);
|
||||
// Maximum of 10 characters in a PIN
|
||||
mPinView.setFilters(new InputFilter[] { new LengthFilter(10) });
|
||||
// Maximum of 16 characters in a PIN
|
||||
mPinView.setFilters(new InputFilter[] { new LengthFilter(BLUETOOTH_PIN_MAX_LENGTH) });
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@@ -30,7 +30,6 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.NetStat;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.telephony.PhoneStateListener;
|
||||
@@ -64,7 +63,6 @@ public class Status extends PreferenceActivity {
|
||||
|
||||
private static final String KEY_WIFI_MAC_ADDRESS = "wifi_mac_address";
|
||||
private static final String KEY_BT_ADDRESS = "bt_address";
|
||||
private static final String KEY_NETWORK_TRAFFIC_STATS = "network_traffic_stats";
|
||||
private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200;
|
||||
private static final int EVENT_SERVICE_STATE_CHANGED = 300;
|
||||
|
||||
@@ -111,7 +109,6 @@ public class Status extends PreferenceActivity {
|
||||
|
||||
case EVENT_UPDATE_STATS:
|
||||
status.updateTimes();
|
||||
status.setNetworkTrafficStats();
|
||||
sendEmptyMessageDelayed(EVENT_UPDATE_STATS, 1000);
|
||||
break;
|
||||
}
|
||||
@@ -350,17 +347,6 @@ public class Status extends PreferenceActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void setNetworkTrafficStats() {
|
||||
long txPkts = NetStat.getTotalTxPkts();
|
||||
long txBytes = NetStat.getTotalTxBytes();
|
||||
long rxPkts = NetStat.getTotalRxPkts();
|
||||
long rxBytes = NetStat.getTotalRxBytes();
|
||||
|
||||
Preference netStatsPref = findPreference(KEY_NETWORK_TRAFFIC_STATS);
|
||||
netStatsPref.setSummary(getString(R.string.status_network_traffic_summary,
|
||||
txPkts, txBytes, rxPkts, rxBytes));
|
||||
}
|
||||
|
||||
void updateTimes() {
|
||||
long at = SystemClock.uptimeMillis() / 1000;
|
||||
long ut = SystemClock.elapsedRealtime() / 1000;
|
||||
|
@@ -47,24 +47,7 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
||||
private static final String ADHOC_CAPABILITY = "[IBSS]";
|
||||
/** String present in capabilities if the scan result is enterprise secured */
|
||||
private static final String ENTERPRISE_CAPABILITY = "-EAP-";
|
||||
|
||||
// Localized strings for different security types
|
||||
private static String LOCALIZED_WPA2;
|
||||
private static String LOCALIZED_WPA;
|
||||
private static String LOCALIZED_WEP;
|
||||
private static String LOCALIZED_OPEN;
|
||||
private static String LOCALIZED_UNKNOWN;
|
||||
private static String LOCALIZED_VERBOSE_WPA2;
|
||||
private static String LOCALIZED_VERBOSE_WPA;
|
||||
private static String LOCALIZED_VERBOSE_WEP;
|
||||
private static String LOCALIZED_VERBOSE_OPEN;
|
||||
|
||||
|
||||
// Localized strings for various messages
|
||||
private static String SUMMARY_NOT_IN_RANGE;
|
||||
private static String SUMMARY_REMEMBERED;
|
||||
private static String SUMMARY_CONNECTION_FAILED;
|
||||
|
||||
public static final String BSSID_ANY = "any";
|
||||
public static final int NETWORK_ID_NOT_SET = -1;
|
||||
/** This should be used with care! */
|
||||
@@ -147,31 +130,8 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
||||
|
||||
void setContext(Context context) {
|
||||
mContext = context;
|
||||
setStrings();
|
||||
}
|
||||
|
||||
private void setStrings() {
|
||||
final Context c = mContext;
|
||||
|
||||
if (SUMMARY_NOT_IN_RANGE == null && c != null) {
|
||||
SUMMARY_NOT_IN_RANGE = c.getString(R.string.summary_not_in_range);
|
||||
SUMMARY_REMEMBERED = c.getString(R.string.summary_remembered);
|
||||
SUMMARY_CONNECTION_FAILED = c.getString(R.string.summary_connection_failed);
|
||||
|
||||
LOCALIZED_OPEN = c.getString(R.string.wifi_security_open);
|
||||
LOCALIZED_WEP = c.getString(R.string.wifi_security_wep);
|
||||
LOCALIZED_WPA = c.getString(R.string.wifi_security_wpa);
|
||||
LOCALIZED_WPA2 = c.getString(R.string.wifi_security_wpa2);
|
||||
|
||||
LOCALIZED_VERBOSE_OPEN = c.getString(R.string.wifi_security_verbose_open);
|
||||
LOCALIZED_VERBOSE_WEP = c.getString(R.string.wifi_security_verbose_wep);
|
||||
LOCALIZED_VERBOSE_WPA = c.getString(R.string.wifi_security_verbose_wpa);
|
||||
LOCALIZED_VERBOSE_WPA2 = c.getString(R.string.wifi_security_verbose_wpa2);
|
||||
|
||||
LOCALIZED_UNKNOWN = c.getString(R.string.wifi_security_unknown);
|
||||
}
|
||||
}
|
||||
|
||||
public void setNetworkId(int networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
@@ -311,12 +271,12 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
||||
}
|
||||
|
||||
public String getHumanReadableSecurity() {
|
||||
if (security.equals(OPEN)) return LOCALIZED_OPEN;
|
||||
else if (security.equals(WEP)) return LOCALIZED_WEP;
|
||||
else if (security.equals(WPA)) return LOCALIZED_WPA;
|
||||
else if (security.equals(WPA2)) return LOCALIZED_WPA2;
|
||||
if (security.equals(OPEN)) return mContext.getString(R.string.wifi_security_open);
|
||||
else if (security.equals(WEP)) return mContext.getString(R.string.wifi_security_wep);
|
||||
else if (security.equals(WPA)) return mContext.getString(R.string.wifi_security_wpa);
|
||||
else if (security.equals(WPA2)) return mContext.getString(R.string.wifi_security_wpa2);
|
||||
|
||||
return LOCALIZED_UNKNOWN;
|
||||
return mContext.getString(R.string.wifi_security_unknown);
|
||||
}
|
||||
|
||||
public void updateFromScanResult(ScanResult scanResult) {
|
||||
@@ -719,22 +679,22 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
||||
buildSummary(sb, WifiStatus.getPrintable(mContext, status), true);
|
||||
|
||||
} else if (!seen) {
|
||||
buildSummary(sb, SUMMARY_NOT_IN_RANGE, true);
|
||||
buildSummary(sb, mContext.getString(R.string.summary_not_in_range), true);
|
||||
|
||||
// Remembered comes second in this case
|
||||
if (!primary && configured) {
|
||||
buildSummary(sb, SUMMARY_REMEMBERED, true);
|
||||
buildSummary(sb, mContext.getString(R.string.summary_remembered), true);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (configured && disabled) {
|
||||
// The connection failure overrides all in this case
|
||||
return SUMMARY_CONNECTION_FAILED;
|
||||
return mContext.getString(R.string.summary_connection_failed);
|
||||
}
|
||||
|
||||
// Remembered comes first in this case
|
||||
if (!primary && configured) {
|
||||
buildSummary(sb, SUMMARY_REMEMBERED, true);
|
||||
buildSummary(sb, mContext.getString(R.string.summary_remembered), true);
|
||||
}
|
||||
|
||||
// If it is seen (and not the primary), show the security type
|
||||
@@ -749,13 +709,13 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
||||
|
||||
private String getVerboseSecurity() {
|
||||
if (WEP.equals(security)) {
|
||||
return LOCALIZED_VERBOSE_WEP;
|
||||
return mContext.getString(R.string.wifi_security_verbose_wep);
|
||||
} else if (WPA.equals(security)) {
|
||||
return LOCALIZED_VERBOSE_WPA;
|
||||
return mContext.getString(R.string.wifi_security_verbose_wpa);
|
||||
} else if (WPA2.equals(security)) {
|
||||
return LOCALIZED_VERBOSE_WPA2;
|
||||
return mContext.getString(R.string.wifi_security_verbose_wpa2);
|
||||
} else if (OPEN.equals(security)) {
|
||||
return LOCALIZED_VERBOSE_OPEN;
|
||||
return mContext.getString(R.string.wifi_security_verbose_open);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@@ -20,51 +20,9 @@ import com.android.settings.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class WifiStatus {
|
||||
|
||||
// e.g., "Connecting"
|
||||
public static String sScanning;
|
||||
public static String sConnecting;
|
||||
public static String sAuthenticating;
|
||||
public static String sObtainingIp;
|
||||
public static String sConnected;
|
||||
public static String sDisconnecting;
|
||||
public static String sDisconnected;
|
||||
public static String sFailed;
|
||||
|
||||
// e.g., "Connecting to %1$s"
|
||||
public static String sScanningFragment;
|
||||
public static String sConnectingFragment;
|
||||
public static String sAuthenticatingFragment;
|
||||
public static String sObtainingIpFragment;
|
||||
public static String sConnectedFragment;
|
||||
public static String sDisconnectingFragment;
|
||||
public static String sDisconnectedFragment;
|
||||
public static String sFailedFragment;
|
||||
|
||||
private static void fillStrings(Context context) {
|
||||
sScanning = context.getString(R.string.status_scanning);
|
||||
sConnecting = context.getString(R.string.status_connecting);
|
||||
sAuthenticating = context.getString(R.string.status_authenticating);
|
||||
sObtainingIp = context.getString(R.string.status_obtaining_ip);
|
||||
sConnected = context.getString(R.string.status_connected);
|
||||
sDisconnecting = context.getString(R.string.status_disconnecting);
|
||||
sDisconnected = context.getString(R.string.status_disconnected);
|
||||
sFailed = context.getString(R.string.status_failed);
|
||||
|
||||
sScanningFragment = context.getString(R.string.fragment_status_scanning);
|
||||
sConnectingFragment = context.getString(R.string.fragment_status_connecting);
|
||||
sAuthenticatingFragment = context.getString(R.string.fragment_status_authenticating);
|
||||
sObtainingIpFragment = context.getString(R.string.fragment_status_obtaining_ip);
|
||||
sConnectedFragment = context.getString(R.string.fragment_status_connected);
|
||||
sDisconnectingFragment = context.getString(R.string.fragment_status_disconnecting);
|
||||
sDisconnectedFragment = context.getString(R.string.fragment_status_disconnected);
|
||||
sFailedFragment = context.getString(R.string.fragment_status_failed);
|
||||
}
|
||||
|
||||
public static String getStatus(Context context, String ssid,
|
||||
NetworkInfo.DetailedState detailedState) {
|
||||
|
||||
@@ -85,27 +43,23 @@ public class WifiStatus {
|
||||
public static String getPrintable(Context context,
|
||||
NetworkInfo.DetailedState detailedState) {
|
||||
|
||||
if (sScanning == null) {
|
||||
fillStrings(context);
|
||||
}
|
||||
|
||||
switch (detailedState) {
|
||||
case AUTHENTICATING:
|
||||
return sAuthenticating;
|
||||
return context.getString(R.string.status_authenticating);
|
||||
case CONNECTED:
|
||||
return sConnected;
|
||||
return context.getString(R.string.status_connected);
|
||||
case CONNECTING:
|
||||
return sConnecting;
|
||||
return context.getString(R.string.status_connecting);
|
||||
case DISCONNECTED:
|
||||
return sDisconnected;
|
||||
return context.getString(R.string.status_disconnected);
|
||||
case DISCONNECTING:
|
||||
return sDisconnecting;
|
||||
return context.getString(R.string.status_disconnecting);
|
||||
case FAILED:
|
||||
return sFailed;
|
||||
return context.getString(R.string.status_failed);
|
||||
case OBTAINING_IPADDR:
|
||||
return sObtainingIp;
|
||||
return context.getString(R.string.status_obtaining_ip);
|
||||
case SCANNING:
|
||||
return sScanning;
|
||||
return context.getString(R.string.status_scanning);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -114,35 +68,31 @@ public class WifiStatus {
|
||||
public static String getPrintableFragment(Context context,
|
||||
NetworkInfo.DetailedState detailedState, String apName) {
|
||||
|
||||
if (sScanningFragment == null) {
|
||||
fillStrings(context);
|
||||
}
|
||||
|
||||
String fragment = null;
|
||||
switch (detailedState) {
|
||||
case AUTHENTICATING:
|
||||
fragment = sAuthenticatingFragment;
|
||||
fragment = context.getString(R.string.fragment_status_authenticating);
|
||||
break;
|
||||
case CONNECTED:
|
||||
fragment = sConnectedFragment;
|
||||
fragment = context.getString(R.string.fragment_status_connected);
|
||||
break;
|
||||
case CONNECTING:
|
||||
fragment = sConnectingFragment;
|
||||
fragment = context.getString(R.string.fragment_status_connecting);
|
||||
break;
|
||||
case DISCONNECTED:
|
||||
fragment = sDisconnectedFragment;
|
||||
fragment = context.getString(R.string.fragment_status_disconnected);
|
||||
break;
|
||||
case DISCONNECTING:
|
||||
fragment = sDisconnectingFragment;
|
||||
fragment = context.getString(R.string.fragment_status_disconnecting);
|
||||
break;
|
||||
case FAILED:
|
||||
fragment = sFailedFragment;
|
||||
fragment = context.getString(R.string.fragment_status_failed);
|
||||
break;
|
||||
case OBTAINING_IPADDR:
|
||||
fragment = sObtainingIpFragment;
|
||||
fragment = context.getString(R.string.fragment_status_obtaining_ip);
|
||||
break;
|
||||
case SCANNING:
|
||||
fragment = sScanningFragment;
|
||||
fragment = context.getString(R.string.fragment_status_scanning);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user