More code cleaning
- remove some dead code - better variable naming - add debug log for exception - clean some unused imports Change-Id: Iec4239a7e75f29d860f286ab089e748e8a672281
This commit is contained in:
@@ -111,13 +111,8 @@ public class Settings extends PreferenceActivity
|
||||
"com.android.settings.TOP_LEVEL_HEADER_ID";
|
||||
private static final String META_DATA_KEY_FRAGMENT_CLASS =
|
||||
"com.android.settings.FRAGMENT_CLASS";
|
||||
|
||||
private static final String EXTRA_UI_OPTIONS = "settings:ui_options";
|
||||
|
||||
private static final String SAVE_KEY_CURRENT_HEADER = "com.android.settings.CURRENT_HEADER";
|
||||
private static final String SAVE_KEY_PARENT_HEADER = "com.android.settings.PARENT_HEADER";
|
||||
|
||||
static final int DIALOG_ONLY_ONE_HOME = 1;
|
||||
|
||||
private static boolean sShowNoHomeNotice = false;
|
||||
|
||||
@@ -362,32 +357,6 @@ public class Settings extends PreferenceActivity
|
||||
super.switchToHeader(header);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to parent fragment and store the grand parent's info
|
||||
* @param className name of the activity wrapper for the parent fragment.
|
||||
*/
|
||||
private void switchToParent(String className) {
|
||||
final ComponentName cn = new ComponentName(this, className);
|
||||
try {
|
||||
final PackageManager pm = getPackageManager();
|
||||
final ActivityInfo parentInfo = pm.getActivityInfo(cn, PackageManager.GET_META_DATA);
|
||||
|
||||
if (parentInfo != null && parentInfo.metaData != null) {
|
||||
String fragmentClass = parentInfo.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS);
|
||||
CharSequence fragmentTitle = parentInfo.loadLabel(pm);
|
||||
Header parentHeader = new Header();
|
||||
parentHeader.fragment = fragmentClass;
|
||||
parentHeader.title = fragmentTitle;
|
||||
mCurrentHeader = parentHeader;
|
||||
|
||||
switchToHeaderLocal(parentHeader);
|
||||
highlightHeader(mTopLevelHeaderId);
|
||||
}
|
||||
} catch (NameNotFoundException nnfe) {
|
||||
Log.w(LOG_TAG, "Could not find parent activity : " + className);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
@@ -711,6 +680,7 @@ public class Settings extends PreferenceActivity
|
||||
mFragmentClass = ai.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS);
|
||||
} catch (NameNotFoundException nnfe) {
|
||||
// No recovery
|
||||
Log.d(LOG_TAG, "Cannot get Metadata for: " + getComponentName().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,8 +726,8 @@ public class Settings extends PreferenceActivity
|
||||
TextView title;
|
||||
TextView summary;
|
||||
Switch switch_;
|
||||
ImageButton button_;
|
||||
View divider_;
|
||||
ImageButton button;
|
||||
View divider;
|
||||
}
|
||||
|
||||
private LayoutInflater mInflater;
|
||||
@@ -849,8 +819,8 @@ public class Settings extends PreferenceActivity
|
||||
view.findViewById(com.android.internal.R.id.title);
|
||||
holder.summary = (TextView)
|
||||
view.findViewById(com.android.internal.R.id.summary);
|
||||
holder.button_ = (ImageButton) view.findViewById(R.id.buttonWidget);
|
||||
holder.divider_ = view.findViewById(R.id.divider);
|
||||
holder.button = (ImageButton) view.findViewById(R.id.buttonWidget);
|
||||
holder.divider = view.findViewById(R.id.divider);
|
||||
break;
|
||||
|
||||
case HEADER_TYPE_NORMAL:
|
||||
@@ -890,16 +860,16 @@ public class Settings extends PreferenceActivity
|
||||
if (header.id == R.id.security_settings) {
|
||||
boolean hasCert = DevicePolicyManager.hasAnyCaCertsInstalled();
|
||||
if (hasCert) {
|
||||
holder.button_.setVisibility(View.VISIBLE);
|
||||
holder.divider_.setVisibility(View.VISIBLE);
|
||||
holder.button.setVisibility(View.VISIBLE);
|
||||
holder.divider.setVisibility(View.VISIBLE);
|
||||
boolean isManaged = mDevicePolicyManager.getDeviceOwner() != null;
|
||||
if (isManaged) {
|
||||
holder.button_.setImageResource(R.drawable.ic_settings_about);
|
||||
holder.button.setImageResource(R.drawable.ic_settings_about);
|
||||
} else {
|
||||
holder.button_.setImageResource(
|
||||
holder.button.setImageResource(
|
||||
android.R.drawable.stat_notify_error);
|
||||
}
|
||||
holder.button_.setOnClickListener(new OnClickListener() {
|
||||
holder.button.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(
|
||||
@@ -908,8 +878,8 @@ public class Settings extends PreferenceActivity
|
||||
}
|
||||
});
|
||||
} else {
|
||||
holder.button_.setVisibility(View.GONE);
|
||||
holder.divider_.setVisibility(View.GONE);
|
||||
holder.button.setVisibility(View.GONE);
|
||||
holder.divider.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
updateCommonHeaderView(header, holder);
|
||||
|
@@ -16,11 +16,8 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.ChooseLockGeneric.ChooseLockGenericFragment;
|
||||
|
||||
/**
|
||||
* Stub class for showing sub-settings; we can't use the main Settings class
|
||||
* since for our app it is a special singleTask class.
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
@@ -40,7 +39,6 @@ import android.net.LinkProperties;
|
||||
import android.net.Uri;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.preference.Preference;
|
||||
@@ -48,23 +46,17 @@ import android.preference.PreferenceActivity.Header;
|
||||
import android.preference.PreferenceFrameLayout;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.provider.ContactsContract.CommonDataKinds;
|
||||
import android.provider.ContactsContract.CommonDataKinds.Phone;
|
||||
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.provider.ContactsContract.Data;
|
||||
import android.provider.ContactsContract.Profile;
|
||||
import android.provider.ContactsContract.RawContacts;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TabWidget;
|
||||
|
||||
import com.android.settings.users.ProfileUpdateReceiver;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
|
Reference in New Issue
Block a user