Remove dead code.
Bug: n/a Test: rebuild Change-Id: I71f8d9d99bbff1186e8df518ec8d27db3447ffbe
This commit is contained in:
@@ -21,6 +21,8 @@ import static android.content.pm.PackageManager.GET_META_DATA;
|
||||
import static android.content.pm.PackageManager.GET_RESOLVED_FILTER;
|
||||
import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -51,7 +53,6 @@ public class SettingsInitialize extends BroadcastReceiver {
|
||||
private static final String TAG = "Settings";
|
||||
private static final String PRIMARY_PROFILE_SETTING =
|
||||
"com.android.settings.PRIMARY_PROFILE_CONTROLLED";
|
||||
private static final String SETTINGS_PACKAGE = "com.android.settings";
|
||||
private static final String WEBVIEW_IMPLEMENTATION_ACTIVITY = ".WebViewImplementation";
|
||||
|
||||
@Override
|
||||
@@ -113,7 +114,8 @@ public class SettingsInitialize extends BroadcastReceiver {
|
||||
return;
|
||||
}
|
||||
ComponentName settingsComponentName =
|
||||
new ComponentName(SETTINGS_PACKAGE, SETTINGS_PACKAGE + WEBVIEW_IMPLEMENTATION_ACTIVITY);
|
||||
new ComponentName(SETTINGS_PACKAGE_NAME,
|
||||
SETTINGS_PACKAGE_NAME + WEBVIEW_IMPLEMENTATION_ACTIVITY);
|
||||
pm.setComponentEnabledSetting(settingsComponentName,
|
||||
userInfo.isAdmin() ?
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
|
||||
|
@@ -111,16 +111,7 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
*/
|
||||
public static final int UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY = 1;
|
||||
|
||||
/**
|
||||
* Color spectrum to use to indicate badness. 0 is completely transparent (no data),
|
||||
* 1 is most bad (red), the last value is least bad (green).
|
||||
*/
|
||||
public static final int[] BADNESS_COLORS = new int[] {
|
||||
0x00000000, 0xffc43828, 0xffe54918, 0xfff47b00,
|
||||
0xfffabf2c, 0xff679e37, 0xff0a7f42
|
||||
};
|
||||
|
||||
private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
public static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
|
||||
public static final String OS_PKG = "os";
|
||||
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.applications;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.app.usage.UsageStats;
|
||||
@@ -91,7 +93,7 @@ public class RecentAppsPreferenceController extends AbstractPreferenceController
|
||||
SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
|
||||
"android",
|
||||
"com.android.phone",
|
||||
"com.android.settings",
|
||||
SETTINGS_PACKAGE_NAME,
|
||||
"com.android.systemui",
|
||||
"com.android.providers.calendar",
|
||||
"com.android.providers.media"
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.biometrics;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -33,8 +35,6 @@ import com.android.settings.core.InstrumentedActivity;
|
||||
*/
|
||||
public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
|
||||
private static final String SETTINGS_PACKAGE = "com.android.settings";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -44,9 +44,10 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
|
||||
// This logic may have to be modified on devices with multiple biometrics.
|
||||
if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
|
||||
intent.setClassName(SETTINGS_PACKAGE, FingerprintEnrollIntroduction.class.getName());
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
||||
FingerprintEnrollIntroduction.class.getName());
|
||||
} else if (pm.hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||
intent.setClassName(SETTINGS_PACKAGE, FaceEnrollIntroduction.class.getName());
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME, FaceEnrollIntroduction.class.getName());
|
||||
}
|
||||
|
||||
startActivity(intent);
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.biometrics;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
@@ -148,7 +150,7 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
|
||||
protected Intent getFingerprintEnrollingIntent() {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", FingerprintEnrollEnrolling.class.getName());
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME, FingerprintEnrollEnrolling.class.getName());
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
|
||||
if (mUserId != UserHandle.USER_NULL) {
|
||||
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.biometrics;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
@@ -114,7 +116,7 @@ public abstract class BiometricStatusPreferenceController extends BasePreference
|
||||
return false;
|
||||
}
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", clazz);
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME, clazz);
|
||||
intent.putExtra(Intent.EXTRA_USER_ID, userId);
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
|
@@ -17,6 +17,8 @@
|
||||
package com.android.settings.biometrics.fingerprint;
|
||||
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
@@ -460,7 +462,7 @@ public class FingerprintSettings extends SubSettings {
|
||||
final String key = pref.getKey();
|
||||
if (KEY_FINGERPRINT_ADD.equals(key)) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings",
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
||||
FingerprintEnrollEnrolling.class.getName());
|
||||
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
|
||||
@@ -613,7 +615,7 @@ public class FingerprintSettings extends SubSettings {
|
||||
if (!helper.launchConfirmationActivity(CONFIRM_REQUEST,
|
||||
getString(R.string.security_settings_fingerprint_preference_title),
|
||||
null, null, challenge, mUserId)) {
|
||||
intent.setClassName("com.android.settings", ChooseLockGeneric.class.getName());
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME, ChooseLockGeneric.class.getName());
|
||||
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
|
||||
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
|
||||
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS,
|
||||
|
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.fuelgauge;
|
||||
|
||||
import android.os.BatteryStats.HistoryItem;
|
||||
import android.telephony.ServiceState;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.fuelgauge.BatteryActiveView.BatteryActiveProvider;
|
||||
|
||||
public class BatteryCellParser implements BatteryInfo.BatteryDataParser, BatteryActiveProvider {
|
||||
|
||||
private final SparseIntArray mData = new SparseIntArray();
|
||||
|
||||
private int mLastValue;
|
||||
private long mLength;
|
||||
private long mLastTime;
|
||||
|
||||
protected int getValue(HistoryItem rec) {
|
||||
int bin;
|
||||
if (((rec.states & HistoryItem.STATE_PHONE_STATE_MASK)
|
||||
>> HistoryItem.STATE_PHONE_STATE_SHIFT)
|
||||
== ServiceState.STATE_POWER_OFF) {
|
||||
bin = 0;
|
||||
} else if ((rec.states & HistoryItem.STATE_PHONE_SCANNING_FLAG) != 0) {
|
||||
bin = 1;
|
||||
} else {
|
||||
bin = (rec.states & HistoryItem.STATE_PHONE_SIGNAL_STRENGTH_MASK)
|
||||
>> HistoryItem.STATE_PHONE_SIGNAL_STRENGTH_SHIFT;
|
||||
bin += 2;
|
||||
}
|
||||
return bin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParsingStarted(long startTime, long endTime) {
|
||||
mLength = endTime - startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPoint(long time, HistoryItem record) {
|
||||
int value = getValue(record);
|
||||
if (value != mLastValue) {
|
||||
mData.put((int) time, value);
|
||||
mLastValue = value;
|
||||
}
|
||||
mLastTime = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataGap() {
|
||||
if (mLastValue != 0) {
|
||||
mData.put((int) mLastTime, 0);
|
||||
mLastValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParsingDone() {
|
||||
if (mLastValue != 0) {
|
||||
mData.put((int) mLastTime, 0);
|
||||
mLastValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPeriod() {
|
||||
return mLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData() {
|
||||
return mData.size() > 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SparseIntArray getColorArray() {
|
||||
SparseIntArray ret = new SparseIntArray();
|
||||
for (int i = 0; i < mData.size(); i++) {
|
||||
ret.put(mData.keyAt(i), getColor(mData.valueAt(i)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int getColor(int i) {
|
||||
return Utils.BADNESS_COLORS[i];
|
||||
}
|
||||
}
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.fuelgauge.batterytip.detectors;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.BatteryStats;
|
||||
import android.text.format.DateUtils;
|
||||
@@ -91,7 +93,7 @@ public class HighUsageDetector implements BatteryTipDetector {
|
||||
// When in test mode, add an app if necessary
|
||||
if (mPolicy.testHighUsageTip && mHighUsageAppList.isEmpty()) {
|
||||
mHighUsageAppList.add(new AppInfo.Builder()
|
||||
.setPackageName("com.android.settings")
|
||||
.setPackageName(SETTINGS_PACKAGE_NAME)
|
||||
.setScreenOnTimeMs(TimeUnit.HOURS.toMillis(3))
|
||||
.build());
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.fuelgauge.batterytip.detectors;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -87,7 +89,7 @@ public class RestrictAppDetector implements BatteryTipDetector {
|
||||
private BatteryTip getFakeData() {
|
||||
final List<AppInfo> highUsageApps = new ArrayList<>();
|
||||
highUsageApps.add(new AppInfo.Builder()
|
||||
.setPackageName("com.android.settings")
|
||||
.setPackageName(SETTINGS_PACKAGE_NAME)
|
||||
.build());
|
||||
return new RestrictAppTip(BatteryTip.StateType.NEW, highUsageApps);
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.password;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Activity;
|
||||
import android.app.KeyguardManager;
|
||||
@@ -408,7 +410,7 @@ public final class ChooseLockSettingsHelper {
|
||||
if (extras != null) {
|
||||
intent.putExtras(extras);
|
||||
}
|
||||
intent.setClassName(ConfirmDeviceCredentialBaseFragment.PACKAGE, activityClass.getName());
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME, activityClass.getName());
|
||||
if (external) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
if (mFragment != null) {
|
||||
|
@@ -17,6 +17,8 @@
|
||||
|
||||
package com.android.settings.password;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
@@ -62,7 +64,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
|
||||
public static Intent createIntent(CharSequence title, CharSequence details) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings",
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
||||
ConfirmDeviceCredentialActivity.class.getName());
|
||||
intent.putExtra(KeyguardManager.EXTRA_TITLE, title);
|
||||
intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION, details);
|
||||
@@ -71,7 +73,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
|
||||
public static Intent createIntent(CharSequence title, CharSequence details, long challenge) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings",
|
||||
intent.setClassName(SETTINGS_PACKAGE_NAME,
|
||||
ConfirmDeviceCredentialActivity.class.getName());
|
||||
intent.putExtra(KeyguardManager.EXTRA_TITLE, title);
|
||||
intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION, details);
|
||||
|
@@ -17,6 +17,8 @@
|
||||
// TODO (b/35202196): move this class out of the root of the package.
|
||||
package com.android.settings.password;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Dialog;
|
||||
import android.app.KeyguardManager;
|
||||
@@ -55,17 +57,16 @@ import com.android.settings.core.InstrumentedFragment;
|
||||
*/
|
||||
public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFragment {
|
||||
|
||||
public static final String PACKAGE = "com.android.settings";
|
||||
public static final String TITLE_TEXT = PACKAGE + ".ConfirmCredentials.title";
|
||||
public static final String HEADER_TEXT = PACKAGE + ".ConfirmCredentials.header";
|
||||
public static final String DETAILS_TEXT = PACKAGE + ".ConfirmCredentials.details";
|
||||
public static final String DARK_THEME = PACKAGE + ".ConfirmCredentials.darkTheme";
|
||||
public static final String TITLE_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.title";
|
||||
public static final String HEADER_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.header";
|
||||
public static final String DETAILS_TEXT = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.details";
|
||||
public static final String DARK_THEME = SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.darkTheme";
|
||||
public static final String SHOW_CANCEL_BUTTON =
|
||||
PACKAGE + ".ConfirmCredentials.showCancelButton";
|
||||
SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.showCancelButton";
|
||||
public static final String SHOW_WHEN_LOCKED =
|
||||
PACKAGE + ".ConfirmCredentials.showWhenLocked";
|
||||
SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.showWhenLocked";
|
||||
public static final String USE_FADE_ANIMATION =
|
||||
PACKAGE + ".ConfirmCredentials.useFadeAnimation";
|
||||
SETTINGS_PACKAGE_NAME + ".ConfirmCredentials.useFadeAnimation";
|
||||
|
||||
protected static final int USER_TYPE_PRIMARY = 1;
|
||||
protected static final int USER_TYPE_MANAGED_PROFILE = 2;
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings.password;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.IActivityManager;
|
||||
@@ -32,8 +34,6 @@ public final class PasswordUtils extends com.android.settingslib.Utils {
|
||||
|
||||
private static final String TAG = "Settings";
|
||||
|
||||
private static final String SETTINGS_PACKAGE_NAME = "com.android.settings";
|
||||
|
||||
/**
|
||||
* Returns whether the uid which the activity with {@code activityToken} is launched from has
|
||||
* been granted the {@code permission}.
|
||||
|
@@ -3,11 +3,11 @@ LOCAL_PATH := $(call my-dir)
|
||||
SETTINGS_AOSP_PATH := packages/apps/Settings
|
||||
|
||||
#############################################################
|
||||
# Build SettingsTest.apk which includes test-only resources.#
|
||||
# Build SettingsRoboTestStub.apk which includes test-only resources.#
|
||||
#############################################################
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_PACKAGE_NAME := SettingsTest
|
||||
LOCAL_PACKAGE_NAME := SettingsRoboTestStub
|
||||
LOCAL_PRIVATE_PLATFORM_APIS := true
|
||||
LOCAL_CERTIFICATE := platform
|
||||
LOCAL_PRIVILEGED_MODULE := true
|
||||
@@ -77,7 +77,7 @@ LOCAL_JAVA_LIBRARIES := \
|
||||
mockito-robolectric-prebuilt \
|
||||
truth-prebuilt
|
||||
|
||||
LOCAL_INSTRUMENTATION_FOR := SettingsTest
|
||||
LOCAL_INSTRUMENTATION_FOR := SettingsRoboTestStub
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
@@ -100,7 +100,7 @@ LOCAL_JAVA_LIBRARIES := \
|
||||
mockito-robolectric-prebuilt \
|
||||
truth-prebuilt
|
||||
|
||||
LOCAL_TEST_PACKAGE := SettingsTest
|
||||
LOCAL_TEST_PACKAGE := SettingsRoboTestStub
|
||||
|
||||
LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))../src \
|
||||
frameworks/base/packages/SettingsLib/search/src \
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.fuelgauge.batterytip;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -60,7 +59,8 @@ public class BatteryTipUtilsTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
FakeFeatureFactory.setupForTest();
|
||||
doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
|
||||
when(mSettingsActivity.getApplicationContext()).thenReturn(RuntimeEnvironment.application);
|
||||
when(mFragment.getContext()).thenReturn(RuntimeEnvironment.application);
|
||||
mRestrictAppTip = spy(new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>()));
|
||||
mEarlyWarningTip = spy(
|
||||
new EarlyWarningTip(BatteryTip.StateType.NEW, true /* powerSaveModeOn */));
|
||||
|
Reference in New Issue
Block a user