Snap for 7846411 from d1118678b1 to tm-release
Change-Id: Ic26a0fc6c7f1093f20c50c7f1b63d75098e1cdaa
This commit is contained in:
@@ -301,6 +301,17 @@
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<!-- Keep compatibility with old shortcuts. -->
|
||||
<activity-alias
|
||||
android:name="Settings$WifiSettings2Activity"
|
||||
android:targetActivity="Settings$WifiSettingsActivity"
|
||||
android:label="@string/wifi_settings"
|
||||
android:icon="@drawable/ic_homepage_network"
|
||||
android:exported="true">
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.wifi.WifiSettings" />
|
||||
</activity-alias>
|
||||
|
||||
<activity
|
||||
android:name="Settings$NetworkProviderSettingsActivity"
|
||||
android:label="@string/provider_internet_settings"
|
||||
|
||||
@@ -6568,6 +6568,8 @@
|
||||
<string name="battery_not_usage">No usage from last full charge</string>
|
||||
<!-- Description for no any battery usage for past 24 hr [CHAR LIMIT=120] -->
|
||||
<string name="battery_not_usage_24hr">No usage for past 24 hr</string>
|
||||
<!-- Description for no usage time but have battery usage [CHAR LIMIT=120] -->
|
||||
<string name="battery_usage_without_time"></string>
|
||||
|
||||
<!-- Graph subtext displayed to user when enhanced battery estimate is being used [CHAR LIMIT=120] -->
|
||||
<string name="advanced_battery_graph_subtext">Battery left estimate is based on your device usage</string>
|
||||
|
||||
@@ -327,10 +327,7 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
}
|
||||
|
||||
if (mEnableTriState) {
|
||||
final long foregroundTimeMs = bundle.getLong(EXTRA_FOREGROUND_TIME);
|
||||
final long backgroundTimeMs = bundle.getLong(EXTRA_BACKGROUND_TIME);
|
||||
final String slotTime = bundle.getString(EXTRA_SLOT_TIME, null);
|
||||
controller.setSummary(getAppActiveTime(foregroundTimeMs, backgroundTimeMs, slotTime));
|
||||
controller.setSummary(getAppActiveTime(bundle));
|
||||
}
|
||||
|
||||
controller.done(context, true /* rebindActions */);
|
||||
@@ -494,16 +491,21 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
mOptimizationMode = mBatteryOptimizeUtils.getAppOptimizationMode();
|
||||
}
|
||||
|
||||
private CharSequence getAppActiveTime(
|
||||
long foregroundTimeMs, long backgroundTimeMs, String slotTime) {
|
||||
private CharSequence getAppActiveTime(Bundle bundle) {
|
||||
final long foregroundTimeMs = bundle.getLong(EXTRA_FOREGROUND_TIME);
|
||||
final long backgroundTimeMs = bundle.getLong(EXTRA_BACKGROUND_TIME);
|
||||
final int consumedPower = bundle.getInt(EXTRA_POWER_USAGE_AMOUNT);
|
||||
final String slotTime = bundle.getString(EXTRA_SLOT_TIME, null);
|
||||
final long totalTimeMs = foregroundTimeMs + backgroundTimeMs;
|
||||
final CharSequence usageTimeSummary;
|
||||
final PowerUsageFeatureProvider powerFeatureProvider =
|
||||
FeatureFactory.getFactory(getContext()).getPowerUsageFeatureProvider(getContext());
|
||||
|
||||
if (totalTimeMs == 0) {
|
||||
final int batteryWithoutUsageTime = consumedPower > 0
|
||||
? R.string.battery_usage_without_time : R.string.battery_not_usage_24hr;
|
||||
usageTimeSummary = getText(powerFeatureProvider.isChartGraphEnabled(getContext())
|
||||
? R.string.battery_not_usage_24hr : R.string.battery_not_usage);
|
||||
? batteryWithoutUsageTime : R.string.battery_not_usage);
|
||||
} else if (slotTime == null) {
|
||||
// Shows summary text with past 24 hr or full charge if slot time is null.
|
||||
usageTimeSummary = powerFeatureProvider.isChartGraphEnabled(getContext())
|
||||
|
||||
@@ -404,15 +404,6 @@ public class NotificationBackend {
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumAppsBypassingDnd(int uid) {
|
||||
try {
|
||||
return sINM.getAppsBypassingDndCount(uid);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldHideSilentStatusBarIcons(Context context) {
|
||||
try {
|
||||
return sINM.shouldHideSilentStatusIcons(context.getPackageName());
|
||||
|
||||
@@ -54,7 +54,6 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
private static final String TAG = "WifiTetherSettings";
|
||||
private static final IntentFilter TETHER_STATE_CHANGE_FILTER;
|
||||
private static final String KEY_WIFI_TETHER_SCREEN = "wifi_tether_settings_screen";
|
||||
private static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
|
||||
|
||||
@VisibleForTesting
|
||||
static final String KEY_WIFI_TETHER_NETWORK_NAME = "wifi_tether_network_name";
|
||||
@@ -204,10 +203,6 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
mSwitchBarController.stopTether();
|
||||
}
|
||||
mWifiManager.setSoftApConfiguration(config);
|
||||
|
||||
if (context instanceof WifiTetherSecurityPreferenceController) {
|
||||
reConfigInitialExpandedChildCount();
|
||||
}
|
||||
}
|
||||
|
||||
private SoftApConfiguration buildNewConfig() {
|
||||
@@ -287,11 +282,4 @@ public class WifiTetherSettings extends RestrictedDashboardFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reConfigInitialExpandedChildCount() {
|
||||
final PreferenceGroup screen = getPreferenceScreen();
|
||||
if (screen != null) {
|
||||
screen.setInitialExpandedChildrenCount(getInitialExpandedChildCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.companion.Association;
|
||||
import android.companion.CompanionDeviceManager;
|
||||
import android.companion.DeviceId;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
@@ -97,8 +98,20 @@ public class BluetoothDetailsCompanionAppsControllerTest extends
|
||||
|
||||
private void addFakeAssociation(String packageName, CharSequence appName) {
|
||||
setupFakeLabelAndInfo(packageName, appName);
|
||||
Association association = new Association(
|
||||
0, mCachedDevice.getAddress(), packageName, "", true, System.currentTimeMillis());
|
||||
|
||||
final int associationId = mAssociations.size() + 1;
|
||||
final DeviceId deviceId =
|
||||
new DeviceId(DeviceId.TYPE_MAC_ADDRESS, mCachedDevice.getAddress());
|
||||
final Association association = new Association(
|
||||
associationId,
|
||||
/* userId */ 0,
|
||||
packageName,
|
||||
Arrays.asList(deviceId),
|
||||
/* deviceProfile */ "",
|
||||
/* managedByCompanionApp */ false,
|
||||
/* notifyOnDeviceNearby */ true,
|
||||
/* timeApprovedMs */ System.currentTimeMillis());
|
||||
|
||||
mAssociations.add(association);
|
||||
showScreen(mController);
|
||||
}
|
||||
|
||||
@@ -437,6 +437,21 @@ public class AdvancedPowerUsageDetailTest {
|
||||
.isEqualTo("No usage for past 24 hr");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitHeader_noUsageTimeButConsumedPower_hasEmptySummary() {
|
||||
Bundle bundle = new Bundle(3);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_BACKGROUND_TIME, /* value */ 0);
|
||||
bundle.putLong(AdvancedPowerUsageDetail.EXTRA_FOREGROUND_TIME, /* value */ 0);
|
||||
bundle.putInt(AdvancedPowerUsageDetail.EXTRA_POWER_USAGE_AMOUNT, /* value */ 10);
|
||||
when(mFragment.getArguments()).thenReturn(bundle);
|
||||
|
||||
mFragment.initHeader();
|
||||
|
||||
ArgumentCaptor<CharSequence> captor = ArgumentCaptor.forClass(CharSequence.class);
|
||||
verify(mEntityHeaderController).setSummary(captor.capture());
|
||||
assertThat(captor.getValue().toString()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitHeader_backgroundTwoMinForegroundZero_hasCorrectSummary() {
|
||||
final long backgroundTimeTwoMinutes = 120000;
|
||||
|
||||
Reference in New Issue
Block a user