Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Test: robotest & manual Change-Id: I1eaa45b576913e57ad9728e3a6fc892c4cf9fdc7
This commit is contained in:
@@ -139,8 +139,8 @@ public class RunningState {
|
|||||||
|
|
||||||
int mSequence = 0;
|
int mSequence = 0;
|
||||||
|
|
||||||
final Comparator<RunningState.MergedItem> mBackgroundComparator
|
final Comparator<RunningState.MergedItem> mBackgroundComparator =
|
||||||
= new Comparator<RunningState.MergedItem>() {
|
new Comparator<RunningState.MergedItem>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(MergedItem lhs, MergedItem rhs) {
|
public int compare(MergedItem lhs, MergedItem rhs) {
|
||||||
if (DEBUG_COMPARE) {
|
if (DEBUG_COMPARE) {
|
||||||
@@ -161,12 +161,14 @@ public class RunningState {
|
|||||||
}
|
}
|
||||||
if (lhs.mProcess == null) return -1;
|
if (lhs.mProcess == null) return -1;
|
||||||
if (rhs.mProcess == null) return 1;
|
if (rhs.mProcess == null) return 1;
|
||||||
if (DEBUG_COMPARE) Log.i(TAG, " Label " + lhs.mProcess.mLabel
|
if (DEBUG_COMPARE) {
|
||||||
|
Log.i(TAG, " Label " + lhs.mProcess.mLabel
|
||||||
+ " with " + rhs.mProcess.mLabel);
|
+ " with " + rhs.mProcess.mLabel);
|
||||||
final ActivityManager.RunningAppProcessInfo lhsInfo
|
}
|
||||||
= lhs.mProcess.mRunningProcessInfo;
|
final ActivityManager.RunningAppProcessInfo lhsInfo =
|
||||||
final ActivityManager.RunningAppProcessInfo rhsInfo
|
lhs.mProcess.mRunningProcessInfo;
|
||||||
= rhs.mProcess.mRunningProcessInfo;
|
final ActivityManager.RunningAppProcessInfo rhsInfo =
|
||||||
|
rhs.mProcess.mRunningProcessInfo;
|
||||||
final boolean lhsBg = lhsInfo.importance
|
final boolean lhsBg = lhsInfo.importance
|
||||||
>= ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND;
|
>= ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND;
|
||||||
final boolean rhsBg = rhsInfo.importance
|
final boolean rhsBg = rhsInfo.importance
|
||||||
@@ -183,7 +185,10 @@ public class RunningState {
|
|||||||
if (lhsA != rhsA) {
|
if (lhsA != rhsA) {
|
||||||
return lhsA ? -1 : 1;
|
return lhsA ? -1 : 1;
|
||||||
}
|
}
|
||||||
if (DEBUG_COMPARE) Log.i(TAG, " Lru " + lhsInfo.lru + " with " + rhsInfo.lru);
|
if (DEBUG_COMPARE) {
|
||||||
|
Log.i(TAG,
|
||||||
|
" Lru " + lhsInfo.lru + " with " + rhsInfo.lru);
|
||||||
|
}
|
||||||
if (lhsInfo.lru != rhsInfo.lru) {
|
if (lhsInfo.lru != rhsInfo.lru) {
|
||||||
return lhsInfo.lru < rhsInfo.lru ? -1 : 1;
|
return lhsInfo.lru < rhsInfo.lru ? -1 : 1;
|
||||||
}
|
}
|
||||||
@@ -221,6 +226,7 @@ public class RunningState {
|
|||||||
// ----- BACKGROUND MONITORING THREAD -----
|
// ----- BACKGROUND MONITORING THREAD -----
|
||||||
|
|
||||||
final HandlerThread mBackgroundThread;
|
final HandlerThread mBackgroundThread;
|
||||||
|
|
||||||
final class BackgroundHandler extends Handler {
|
final class BackgroundHandler extends Handler {
|
||||||
public BackgroundHandler(Looper looper) {
|
public BackgroundHandler(Looper looper) {
|
||||||
super(looper);
|
super(looper);
|
||||||
@@ -776,9 +782,9 @@ public class RunningState {
|
|||||||
|
|
||||||
private RunningState(Context context) {
|
private RunningState(Context context) {
|
||||||
mApplicationContext = context.getApplicationContext();
|
mApplicationContext = context.getApplicationContext();
|
||||||
mAm = (ActivityManager)mApplicationContext.getSystemService(Context.ACTIVITY_SERVICE);
|
mAm = mApplicationContext.getSystemService(ActivityManager.class);
|
||||||
mPm = mApplicationContext.getPackageManager();
|
mPm = mApplicationContext.getPackageManager();
|
||||||
mUm = (UserManager)mApplicationContext.getSystemService(Context.USER_SERVICE);
|
mUm = mApplicationContext.getSystemService(UserManager.class);
|
||||||
mMyUserId = UserHandle.myUserId();
|
mMyUserId = UserHandle.myUserId();
|
||||||
UserInfo userInfo = mUm.getUserInfo(mMyUserId);
|
UserInfo userInfo = mUm.getUserInfo(mMyUserId);
|
||||||
mHideManagedProfiles = userInfo == null || !userInfo.canHaveProfile();
|
mHideManagedProfiles = userInfo == null || !userInfo.canHaveProfile();
|
||||||
@@ -1119,8 +1125,7 @@ public class RunningState {
|
|||||||
if (pi.mCurSeq == mSequence) {
|
if (pi.mCurSeq == mSequence) {
|
||||||
pi.ensureLabel(pm);
|
pi.ensureLabel(pm);
|
||||||
if (pi.mPid == 0) {
|
if (pi.mPid == 0) {
|
||||||
// Sanity: a non-process can't be dependent on
|
// Validation: a non-process can't be dependent on anything.
|
||||||
// anything.
|
|
||||||
pi.mDependentProcesses.clear();
|
pi.mDependentProcesses.clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -112,7 +112,7 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
|
|||||||
|
|
||||||
for (int i = 0, size = batteryTips.size(); i < size; i++) {
|
for (int i = 0, size = batteryTips.size(); i < size; i++) {
|
||||||
final BatteryTip batteryTip = mBatteryTips.get(i);
|
final BatteryTip batteryTip = mBatteryTips.get(i);
|
||||||
batteryTip.sanityCheck(mContext);
|
batteryTip.validateCheck(mContext);
|
||||||
if (batteryTip.getState() != BatteryTip.StateType.INVISIBLE) {
|
if (batteryTip.getState() != BatteryTip.StateType.INVISIBLE) {
|
||||||
batteryTip.updatePreference(mCardPreference);
|
batteryTip.updatePreference(mCardPreference);
|
||||||
mBatteryTipMap.put(mCardPreference.getKey(), batteryTip);
|
mBatteryTipMap.put(mCardPreference.getKey(), batteryTip);
|
||||||
|
@@ -138,7 +138,7 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
|
|||||||
* Check whether data is still make sense. If not, try recover.
|
* Check whether data is still make sense. If not, try recover.
|
||||||
* @param context used to do validate check
|
* @param context used to do validate check
|
||||||
*/
|
*/
|
||||||
public void sanityCheck(Context context) {
|
public void validateCheck(Context context) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -107,8 +107,8 @@ public class RestrictAppTip extends BatteryTip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sanityCheck(Context context) {
|
public void validateCheck(Context context) {
|
||||||
super.sanityCheck(context);
|
super.validateCheck(context);
|
||||||
|
|
||||||
// Set it invisible if there is no valid app
|
// Set it invisible if there is no valid app
|
||||||
mRestrictAppList.removeIf(AppLabelPredicate.getInstance(context));
|
mRestrictAppList.removeIf(AppLabelPredicate.getInstance(context));
|
||||||
|
@@ -34,7 +34,6 @@ import android.os.Parcel;
|
|||||||
import com.android.internal.logging.nano.MetricsProto;
|
import com.android.internal.logging.nano.MetricsProto;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.fuelgauge.batterytip.AppInfo;
|
import com.android.settings.fuelgauge.batterytip.AppInfo;
|
||||||
import com.android.settings.testutils.BatteryTestUtils;
|
|
||||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -45,10 +44,10 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.RuntimeEnvironment;
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
import org.robolectric.util.ReflectionHelpers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.robolectric.util.ReflectionHelpers;
|
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class RestrictAppTipTest {
|
public class RestrictAppTipTest {
|
||||||
@@ -198,7 +197,7 @@ public class RestrictAppTipTest {
|
|||||||
appInfos.add(mUninstallAppInfo);
|
appInfos.add(mUninstallAppInfo);
|
||||||
final BatteryTip batteryTip = new RestrictAppTip(BatteryTip.StateType.NEW, appInfos);
|
final BatteryTip batteryTip = new RestrictAppTip(BatteryTip.StateType.NEW, appInfos);
|
||||||
|
|
||||||
batteryTip.sanityCheck(mContext);
|
batteryTip.validateCheck(mContext);
|
||||||
|
|
||||||
assertThat(batteryTip.getState()).isEqualTo(BatteryTip.StateType.INVISIBLE);
|
assertThat(batteryTip.getState()).isEqualTo(BatteryTip.StateType.INVISIBLE);
|
||||||
}
|
}
|
||||||
@@ -210,7 +209,7 @@ public class RestrictAppTipTest {
|
|||||||
appInfos.add(mUninstallAppInfo);
|
appInfos.add(mUninstallAppInfo);
|
||||||
final BatteryTip batteryTip = new RestrictAppTip(BatteryTip.StateType.NEW, appInfos);
|
final BatteryTip batteryTip = new RestrictAppTip(BatteryTip.StateType.NEW, appInfos);
|
||||||
|
|
||||||
batteryTip.sanityCheck(mContext);
|
batteryTip.validateCheck(mContext);
|
||||||
|
|
||||||
assertThat(batteryTip.getState()).isEqualTo(BatteryTip.StateType.NEW);
|
assertThat(batteryTip.getState()).isEqualTo(BatteryTip.StateType.NEW);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user