Snap for 7845934 from c1770fe4cf to sc-v2-release
Change-Id: I0d25cfc12dcb40ba31086ee04d3228493e7f3f50
This commit is contained in:
@@ -212,8 +212,6 @@
|
||||
<string name="bluetooth_notif_message">Tap to pair with <xliff:g id="device_name">%1$s</xliff:g>.</string>
|
||||
<!-- Item in bluetooth settings screen, used to show the list of received files [CHAR LIMIT=30] -->
|
||||
<string name="bluetooth_show_received_files">Received files</string>
|
||||
<!-- Item in bluetooth settings screen, used to show the list of Files received via Bluetooth [CHAR LIMIT=NONE] -->
|
||||
<string name="bluetooth_show_files_received_via_bluetooth">Files received via Bluetooth</string>
|
||||
|
||||
<!-- Title for contextual Bluetooth devices card when Bluetooth is off [CHAR LIMIT=NONE]-->
|
||||
<string name="bluetooth_devices_card_off_title">Bluetooth is off</string>
|
||||
@@ -4800,7 +4798,7 @@
|
||||
<!-- Manage applications, individual application screen, confirmation dialog title. Displays when user selects to "Clear data". -->
|
||||
<string name="clear_data_dlg_title">Delete app data?</string>
|
||||
<!-- Manage applications, individual application screen, confirmation dialog message. Displays when user selects to "Clear data". It warns the user of the consequences of clearing the data for an app. -->
|
||||
<string name="clear_data_dlg_text">All this app\u2019s data will be deleted permanently. This includes all files, settings, accounts, databases, etc.</string>
|
||||
<string name="clear_data_dlg_text">This app\u2019s data will be permanently deleted. This includes files, settings, databases, and other app data.</string>
|
||||
<!-- Manage applications, individual application screen, confirmation dialog button. Displays when user selects to "Clear data". Goes through with the clearing of the data. -->
|
||||
<string name="dlg_ok">OK</string>
|
||||
<!-- Manage applications, individual application screen, confirmation dialog button. Displays when user selects to "Clear data". -->
|
||||
@@ -6560,6 +6558,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>
|
||||
|
||||
@@ -60,11 +60,6 @@
|
||||
android:fragment="com.android.settings.print.PrintSettingsFragment"
|
||||
android:order="-3"/>
|
||||
|
||||
<Preference
|
||||
android:key="bt_received_files"
|
||||
android:icon="@drawable/ic_folder_vd_theme_24"
|
||||
android:title="@string/bluetooth_show_files_received_via_bluetooth"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="uwb_settings"
|
||||
android:title="@string/uwb_settings_title"
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
/**
|
||||
* Controller that shows received files
|
||||
*/
|
||||
public class BluetoothFilesPreferenceController extends BasePreferenceController
|
||||
implements PreferenceControllerMixin {
|
||||
private static final String TAG = "BluetoothFilesPrefCtrl";
|
||||
|
||||
public static final String KEY_RECEIVED_FILES = "bt_received_files";
|
||||
|
||||
/* Private intent to show the list of received files */
|
||||
@VisibleForTesting
|
||||
static final String ACTION_OPEN_FILES = "com.android.bluetooth.action.TransferHistory";
|
||||
@VisibleForTesting
|
||||
static final String EXTRA_SHOW_ALL_FILES = "android.btopp.intent.extra.SHOW_ALL";
|
||||
@VisibleForTesting
|
||||
static final String EXTRA_DIRECTION = "direction";
|
||||
|
||||
private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
public BluetoothFilesPreferenceController(Context context) {
|
||||
super(context, KEY_RECEIVED_FILES);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)
|
||||
? AVAILABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY_RECEIVED_FILES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (KEY_RECEIVED_FILES.equals(preference.getKey())) {
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
SettingsEnums.ACTION_BLUETOOTH_FILES);
|
||||
Intent intent = new Intent(ACTION_OPEN_FILES);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.putExtra(EXTRA_DIRECTION, 1 /* DIRECTION_INBOUND */);
|
||||
intent.putExtra(EXTRA_SHOW_ALL_FILES, true);
|
||||
mContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import android.content.pm.PackageManager;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.bluetooth.BluetoothFilesPreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.nfc.AndroidBeamPreferenceController;
|
||||
import com.android.settings.print.PrintSettingPreferenceController;
|
||||
@@ -84,8 +83,6 @@ public class AdvancedConnectedDeviceDashboardFragment extends DashboardFragment
|
||||
Lifecycle lifecycle) {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
|
||||
controllers.add(new BluetoothFilesPreferenceController(context));
|
||||
|
||||
final PrintSettingPreferenceController printerController =
|
||||
new PrintSettingPreferenceController(context);
|
||||
|
||||
|
||||
@@ -326,10 +326,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 */);
|
||||
@@ -493,16 +490,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())
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class BluetoothFilesPreferenceControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private BluetoothFilesPreferenceController mController;
|
||||
private Preference mPreference;
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
mController = new BluetoothFilesPreferenceController(mContext);
|
||||
mPreference = new Preference(mContext);
|
||||
mPreference.setKey(BluetoothFilesPreferenceController.KEY_RECEIVED_FILES);
|
||||
doReturn(mPackageManager).when(mContext).getPackageManager();
|
||||
doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePreferenceTreeClick_sendBroadcast() {
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
|
||||
final Intent intent = ShadowApplication.getInstance().getNextStartedActivity();
|
||||
assertThat(intent).isNotNull();
|
||||
assertThat(intent.getAction())
|
||||
.isEqualTo(BluetoothFilesPreferenceController.ACTION_OPEN_FILES);
|
||||
|
||||
final Bundle bundle = intent.getExtras();
|
||||
assertThat(bundle.getInt(BluetoothFilesPreferenceController.EXTRA_DIRECTION)).isEqualTo(1);
|
||||
assertThat(bundle.getBoolean(BluetoothFilesPreferenceController.EXTRA_SHOW_ALL_FILES))
|
||||
.isTrue();
|
||||
}
|
||||
}
|
||||
@@ -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