Snap for 7166403 from 6977d42c2a to sc-v2-release
Change-Id: If950e7f8af06ce5d659a5da77acbabe08f9d43c1
This commit is contained in:
18
Android.bp
18
Android.bp
@@ -110,3 +110,21 @@ android_library_import {
|
||||
name: "contextualcards",
|
||||
aars: ["libs/contextualcards.aar"],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "Settings_proguard_flags",
|
||||
srcs: ["proguard.flags"],
|
||||
}
|
||||
|
||||
// The sources for Settings need to be exposed to SettingsGoogle, etc.
|
||||
// so they can run the com.android.settingslib.search.IndexableProcessor
|
||||
// over all the sources together.
|
||||
filegroup {
|
||||
name: "Settings_srcs",
|
||||
srcs: ["src/**/*.java"],
|
||||
}
|
||||
|
||||
filegroup {
|
||||
name: "Settings_manifest",
|
||||
srcs: ["AndroidManifest.xml"],
|
||||
}
|
||||
|
||||
@@ -1272,6 +1272,7 @@
|
||||
<activity
|
||||
android:name=".notification.history.NotificationHistoryActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.SubSettings"
|
||||
android:label="@string/notification_history_title">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.settings.NOTIFICATION_HISTORY" />
|
||||
|
||||
@@ -28,17 +28,6 @@
|
||||
android:value="com.android.settings.Settings$ManageExternalStorageActivity" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:key="high_power_apps"
|
||||
android:title="@string/high_power_apps"
|
||||
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
|
||||
settings:keywords="@string/keywords_ignore_optimizations"
|
||||
settings:controller="com.android.settings.applications.specialaccess.HighPowerAppsController">
|
||||
<extra
|
||||
android:name="classname"
|
||||
android:value="com.android.settings.Settings$HighPowerApplicationsActivity" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:key="interact_across_profiles"
|
||||
android:title="@string/interact_across_profiles_title"
|
||||
|
||||
@@ -1,36 +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.applications.specialaccess;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
public class HighPowerAppsController extends BasePreferenceController {
|
||||
|
||||
public HighPowerAppsController(Context context, String key) {
|
||||
super(context, key);
|
||||
}
|
||||
|
||||
@AvailabilityStatus
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_high_power_apps)
|
||||
? AVAILABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -28,8 +29,11 @@ import com.android.settings.core.TogglePreferenceController;
|
||||
*/
|
||||
public class AdaptiveConnectivityTogglePreferenceController extends TogglePreferenceController {
|
||||
|
||||
private final WifiManager mWifiManager;
|
||||
|
||||
public AdaptiveConnectivityTogglePreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mWifiManager = context.getSystemService(WifiManager.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,6 +57,7 @@ public class AdaptiveConnectivityTogglePreferenceController extends TogglePrefer
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.ADAPTIVE_CONNECTIVITY_ENABLED,
|
||||
isChecked ? 1 : 0);
|
||||
mWifiManager.setWifiScoringEnabled(isChecked);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import static android.provider.Settings.Secure.NOTIFICATION_HISTORY_ENABLED;
|
||||
import static androidx.core.view.accessibility.AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUSED;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.INotificationManager;
|
||||
import android.content.ComponentName;
|
||||
@@ -55,6 +54,7 @@ import com.android.internal.logging.UiEventLogger;
|
||||
import com.android.internal.logging.UiEventLoggerImpl;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.notification.NotificationBackend;
|
||||
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
import com.android.settingslib.widget.MainSwitchBar;
|
||||
import com.android.settingslib.widget.OnMainSwitchChangeListener;
|
||||
@@ -65,7 +65,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class NotificationHistoryActivity extends Activity {
|
||||
public class NotificationHistoryActivity extends CollapsingToolbarBaseActivity {
|
||||
|
||||
private static String TAG = "NotifHistory";
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class UriAuthenticationPolicyAdapter extends
|
||||
public void onBindViewHolder(UriAuthenticationPolicyAdapter.UriViewHolder holder,
|
||||
int position) {
|
||||
Uri uri = mUris.get(position);
|
||||
holder.mUriNameView.setText(uri.toString());
|
||||
holder.mUriNameView.setText(Uri.decode(uri.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.net.module.util.NetUtils;
|
||||
import com.android.net.module.util.Inet4AddressUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
@@ -99,7 +99,6 @@ import com.android.wifitrackerlib.WifiEntry.WifiEntryCallback;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -873,10 +872,8 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
|
||||
|
||||
private static String ipv4PrefixLengthToSubnetMask(int prefixLength) {
|
||||
try {
|
||||
InetAddress all = InetAddress.getByAddress(
|
||||
new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255});
|
||||
return NetUtils.getNetworkPart(all, prefixLength).getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
return Inet4AddressUtils.getPrefixMaskAsInet4Address(prefixLength).getHostAddress();
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,3 +97,15 @@ android_robolectric_test {
|
||||
"SettingsLib-search",
|
||||
],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "Settings-robo-testutils",
|
||||
srcs: ["src/com/android/settings/testutils/**/*.java"],
|
||||
|
||||
libs: [
|
||||
"Settings-core",
|
||||
"Robolectric_all-target",
|
||||
"mockito-robolectric-prebuilt",
|
||||
"truth-prebuilt",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,56 +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.applications.specialaccess;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class HighPowerAppsControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private HighPowerAppsController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application.getApplicationContext());
|
||||
mController = new HighPowerAppsController(mContext, "key");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHighPowerApps_byDefault_shouldBeShown() {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void testHighPowerApps_ifDisabled_shouldNotBeShown() {
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,9 @@ import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.ProxyInfo;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -39,7 +36,7 @@ public class GlobalHttpProxyPreferenceControllerTest {
|
||||
|
||||
private static final String KEY_GLOBAL_HTTP_PROXY = "global_http_proxy";
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
@Mock
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private ConnectivityManager mCm;
|
||||
@@ -49,6 +46,7 @@ public class GlobalHttpProxyPreferenceControllerTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mCm);
|
||||
mController = new GlobalHttpProxyPreferenceController(mContext);
|
||||
}
|
||||
|
||||
@@ -61,12 +59,6 @@ public class GlobalHttpProxyPreferenceControllerTest {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePreferenceTreeClick() {
|
||||
assertThat(mController.handlePreferenceTreeClick(new Preference(mContext, null, 0, 0)))
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPreferenceKey() {
|
||||
assertThat(mController.getPreferenceKey()).isEqualTo(KEY_GLOBAL_HTTP_PROXY);
|
||||
|
||||
@@ -19,8 +19,13 @@ package com.android.settings.network;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -29,6 +34,7 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class AdaptiveConnectivityTogglePreferenceControllerTest {
|
||||
@@ -37,12 +43,16 @@ public class AdaptiveConnectivityTogglePreferenceControllerTest {
|
||||
|
||||
@Mock(answer = RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@Mock
|
||||
WifiManager mWifiManager;
|
||||
|
||||
private AdaptiveConnectivityTogglePreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
|
||||
mController = new AdaptiveConnectivityTogglePreferenceController(mContext, PREF_KEY);
|
||||
}
|
||||
|
||||
@@ -61,6 +71,7 @@ public class AdaptiveConnectivityTogglePreferenceControllerTest {
|
||||
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.ADAPTIVE_CONNECTIVITY_ENABLED, 1))
|
||||
.isEqualTo(1);
|
||||
verify(mWifiManager, atLeastOnce()).setWifiScoringEnabled(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -73,5 +84,6 @@ public class AdaptiveConnectivityTogglePreferenceControllerTest {
|
||||
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.ADAPTIVE_CONNECTIVITY_ENABLED, 1))
|
||||
.isEqualTo(0);
|
||||
verify(mWifiManager).setWifiScoringEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user