Merge changes I21f2bbbf,If9914195,I5a71413f,I85a8ff3a,Ibb3729c9 into nyc-dev
* changes: Fix battery history detail up Fix clickability of conditionals Try to recycle prefs in battery summary Don't use animations for security settings Fix Settings home lifecycle
This commit is contained in:
@@ -29,7 +29,6 @@ import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Bundle;
|
||||
@@ -53,10 +52,8 @@ import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.settings.TimeoutListPreference;
|
||||
import com.android.settings.TrustAgentUtils.TrustAgentComponentInfo;
|
||||
import com.android.settings.fingerprint.FingerprintSettings;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
@@ -71,7 +68,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||
|
||||
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
|
||||
/**
|
||||
@@ -212,6 +208,14 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
||||
return resid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
|
||||
if (!preferenceScreen.isAttached()) {
|
||||
preferenceScreen.setShouldUseGeneratedIds(false);
|
||||
}
|
||||
super.setPreferenceScreen(preferenceScreen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Important!
|
||||
*
|
||||
|
@@ -58,11 +58,14 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
|
||||
private static final String SUGGESTIONS = "suggestions";
|
||||
|
||||
private static final String EXTRA_SCROLL_POSITION = "scroll_position";
|
||||
|
||||
private FocusRecyclerView mDashboard;
|
||||
private DashboardAdapter mAdapter;
|
||||
private SummaryLoader mSummaryLoader;
|
||||
private ConditionManager mConditionManager;
|
||||
private SuggestionParser mSuggestionParser;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
|
||||
@Override
|
||||
protected int getMetricsCategory() {
|
||||
@@ -133,17 +136,28 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
return inflater.inflate(R.layout.dashboard, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(EXTRA_SCROLL_POSITION, mLayoutManager.findFirstVisibleItemPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
mDashboard = (FocusRecyclerView) view.findViewById(R.id.dashboard_container);
|
||||
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
||||
llm.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
mDashboard.setLayoutManager(llm);
|
||||
mLayoutManager = new LinearLayoutManager(getContext());
|
||||
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
if (bundle != null) {
|
||||
int scrollPosition = bundle.getInt(EXTRA_SCROLL_POSITION);
|
||||
mLayoutManager.scrollToPosition(scrollPosition);
|
||||
}
|
||||
mDashboard.setLayoutManager(mLayoutManager);
|
||||
mDashboard.setHasFixedSize(true);
|
||||
mDashboard.setListener(this);
|
||||
mAdapter = new DashboardAdapter(getContext());
|
||||
mAdapter.setConditions(mConditionManager.getConditions());
|
||||
mAdapter.setSuggestions(mSuggestionParser);
|
||||
mDashboard.setAdapter(mAdapter);
|
||||
mSummaryLoader.setAdapter(mAdapter);
|
||||
ConditionAdapterUtils.addDismiss(mDashboard);
|
||||
|
||||
@@ -164,7 +178,6 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
|
||||
// recheck to see if any suggestions have been changed.
|
||||
mAdapter.setSuggestions(mSuggestionParser);
|
||||
mDashboard.setAdapter(mAdapter);
|
||||
|
||||
long delta = System.currentTimeMillis() - start;
|
||||
Log.d(TAG, "rebuildUI took: " + delta + " ms");
|
||||
|
@@ -61,8 +61,9 @@ public class ConditionAdapterUtils {
|
||||
public static void bindViews(final Condition condition,
|
||||
DashboardAdapter.DashboardItemHolder view, boolean isExpanded,
|
||||
View.OnClickListener onClickListener, View.OnClickListener onExpandListener) {
|
||||
view.itemView.setTag(condition);
|
||||
view.itemView.setOnClickListener(onClickListener);
|
||||
View card = view.itemView.findViewById(R.id.content);
|
||||
card.setTag(condition);
|
||||
card.setOnClickListener(onClickListener);
|
||||
view.icon.setImageIcon(condition.getIcon());
|
||||
view.title.setText(condition.getTitle());
|
||||
ImageView expand = (ImageView) view.itemView.findViewById(R.id.expand_indicator);
|
||||
|
@@ -28,13 +28,13 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.os.BatteryStatsHelper;
|
||||
import com.android.settings.InstrumentedFragment;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.fuelgauge.BatteryActiveView.BatteryActiveProvider;
|
||||
import com.android.settingslib.BatteryInfo;
|
||||
import com.android.settingslib.graph.UsageView;
|
||||
|
||||
public class BatteryHistoryDetail extends InstrumentedFragment {
|
||||
public class BatteryHistoryDetail extends SettingsPreferenceFragment {
|
||||
public static final String EXTRA_STATS = "stats";
|
||||
public static final String EXTRA_BROADCAST = "broadcast";
|
||||
|
||||
|
@@ -28,6 +28,7 @@ import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
import android.text.TextUtils;
|
||||
import android.util.SparseArray;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Menu;
|
||||
@@ -167,10 +168,15 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
}
|
||||
|
||||
private void addNotAvailableMessage() {
|
||||
Preference notAvailable = new Preference(getPrefContext());
|
||||
final String NOT_AVAILABLE = "not_available";
|
||||
Preference notAvailable = getCachedPreference(NOT_AVAILABLE);
|
||||
if (notAvailable == null) {
|
||||
notAvailable = new Preference(getPrefContext());
|
||||
notAvailable.setKey(NOT_AVAILABLE);
|
||||
notAvailable.setTitle(R.string.power_usage_not_available);
|
||||
mAppListGroup.addPreference(notAvailable);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isSharedGid(int uid) {
|
||||
return UserHandle.getAppIdFromSharedAppGid(uid) > 0;
|
||||
@@ -274,7 +280,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
super.refreshStats();
|
||||
PowerWhitelistBackend powerWhiteist = PowerWhitelistBackend.getInstance();
|
||||
updatePreference(mHistPref);
|
||||
mAppListGroup.removeAll();
|
||||
cacheRemoveAllPrefs(mAppListGroup);
|
||||
mAppListGroup.setOrderingAsAdded(false);
|
||||
boolean addedSome = false;
|
||||
|
||||
@@ -336,8 +342,16 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
userHandle);
|
||||
final CharSequence contentDescription = mUm.getBadgedLabelForUser(entry.getLabel(),
|
||||
userHandle);
|
||||
final PowerGaugePreference pref = new PowerGaugePreference(getPrefContext(),
|
||||
badgedIcon, contentDescription, entry);
|
||||
final String key = sipper.drainType == DrainType.APP ? sipper.getPackages() != null
|
||||
? TextUtils.concat(sipper.getPackages()).toString()
|
||||
: String.valueOf(sipper.getUid())
|
||||
: sipper.drainType.toString();
|
||||
PowerGaugePreference pref = (PowerGaugePreference) getCachedPreference(key);
|
||||
if (pref == null) {
|
||||
pref = new PowerGaugePreference(getPrefContext(), badgedIcon,
|
||||
contentDescription, entry);
|
||||
pref.setKey(key);
|
||||
}
|
||||
|
||||
final double percentOfMax = (sipper.totalPowerMah * 100)
|
||||
/ mStatsHelper.getMaxPower();
|
||||
@@ -368,6 +382,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
if (!addedSome) {
|
||||
addNotAvailableMessage();
|
||||
}
|
||||
removeCachedPrefs(mAppListGroup);
|
||||
|
||||
BatteryEntry.startRequestQueue();
|
||||
}
|
||||
|
Reference in New Issue
Block a user