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