Add @UnsupportedAppUsage annotations
For packages:
com.android.internal
com.android.internal.annotations
com.android.internal.app
com.android.internal.app.procstats
com.android.internal.appwidget
com.android.internal.backup
com.android.internal.car
com.android.internal.content
com.android.internal.inputmethod
com.android.internal.location
com.android.internal.logging
com.android.internal.midi
com.android.internal.net
com.android.internal.os
com.android.internal.policy
com.android.internal.statusbar
com.android.internal.telecom
com.android.internal.telephony.euicc
com.android.internal.textservice
com.android.internal.util
com.android.internal.view
com.android.internal.view.animation
com.android.internal.view.menu
com.android.internal.widget
This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.
Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@
Bug: 110868826
Test: m
Change-Id: Ib31b52e6957869e5744dadbb35cb4584ef17187f
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index f314872..c65dd6f 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -18,6 +18,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.UnsupportedAppUsage;
import android.app.ActivityManager;
import android.bluetooth.BluetoothActivityEnergyInfo;
import android.bluetooth.UidTraffic;
@@ -602,8 +603,11 @@
// In order to do this, we must refresh each timer whenever the number of active timers
// changes.
@VisibleForTesting
+ @UnsupportedAppUsage
protected ArrayList<StopwatchTimer> mPartialTimers = new ArrayList<>();
+ @UnsupportedAppUsage
final ArrayList<StopwatchTimer> mFullTimers = new ArrayList<>();
+ @UnsupportedAppUsage
final ArrayList<StopwatchTimer> mWindowTimers = new ArrayList<>();
final ArrayList<StopwatchTimer> mDrawTimers = new ArrayList<>();
final SparseArray<ArrayList<StopwatchTimer>> mSensorTimers = new SparseArray<>();
@@ -982,6 +986,7 @@
*/
private final HashMap<String, SamplingTimer> mKernelWakelockStats = new HashMap<>();
+ @UnsupportedAppUsage
public Map<String, ? extends Timer> getKernelWakelockStats() {
return mKernelWakelockStats;
}
@@ -1298,6 +1303,7 @@
* State for keeping track of counting information.
*/
public static class Counter extends BatteryStats.Counter implements TimeBaseObs {
+ @UnsupportedAppUsage
final AtomicInteger mCount = new AtomicInteger();
final TimeBase mTimeBase;
int mLoadedCount;
@@ -1853,6 +1859,7 @@
* @param out the Parcel to be written to.
* @param timer a Timer, or null.
*/
+ @UnsupportedAppUsage
public static void writeTimerToParcel(Parcel out, Timer timer, long elapsedRealtimeUs) {
if (timer == null) {
out.writeInt(0); // indicates null
@@ -1864,6 +1871,7 @@
}
@Override
+ @UnsupportedAppUsage
public long getTotalTimeLocked(long elapsedRealtimeUs, int which) {
long val = computeRunTimeLocked(mTimeBase.getRealtime(elapsedRealtimeUs));
if (which == STATS_SINCE_UNPLUGGED) {
@@ -1876,6 +1884,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getCountLocked(int which) {
int val = computeCurrentCountLocked();
if (which == STATS_SINCE_UNPLUGGED) {
@@ -2651,6 +2660,7 @@
}
@Override
+ @UnsupportedAppUsage
public void detach() {
super.detach();
if (mTimerPool != null) {
@@ -4931,6 +4941,7 @@
}
}
+ @UnsupportedAppUsage
public void noteScreenBrightnessLocked(int brightness) {
// Bin the brightness.
int bin = brightness / (256/NUM_SCREEN_BRIGHTNESS_BINS);
@@ -4954,6 +4965,7 @@
}
}
+ @UnsupportedAppUsage
public void noteUserActivityLocked(int uid, int event) {
if (mOnBatteryInternal) {
uid = mapUid(uid);
@@ -5188,6 +5200,7 @@
}
}
+ @UnsupportedAppUsage
public void notePhoneOnLocked() {
if (!mPhoneOn) {
final long elapsedRealtime = mClocks.elapsedRealtime();
@@ -5201,6 +5214,7 @@
}
}
+ @UnsupportedAppUsage
public void notePhoneOffLocked() {
if (mPhoneOn) {
final long elapsedRealtime = mClocks.elapsedRealtime();
@@ -5370,12 +5384,14 @@
updateAllPhoneStateLocked(state, simState, mPhoneSignalStrengthBinRaw);
}
+ @UnsupportedAppUsage
public void notePhoneSignalStrengthLocked(SignalStrength signalStrength) {
// Bin the strength.
int bin = signalStrength.getLevel();
updateAllPhoneStateLocked(mPhoneServiceStateRaw, mPhoneSimStateRaw, bin);
}
+ @UnsupportedAppUsage
public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData) {
// BatteryStats uses 0 to represent no network type.
// Telephony does not have a concept of no network type, and uses 0 to represent unknown.
@@ -5434,6 +5450,7 @@
}
}
+ @UnsupportedAppUsage
public void noteAudioOnLocked(int uid) {
uid = mapUid(uid);
final long elapsedRealtime = mClocks.elapsedRealtime();
@@ -5449,6 +5466,7 @@
getUidStatsLocked(uid).noteAudioTurnedOnLocked(elapsedRealtime);
}
+ @UnsupportedAppUsage
public void noteAudioOffLocked(int uid) {
if (mAudioOnNesting == 0) {
return;
@@ -5466,6 +5484,7 @@
getUidStatsLocked(uid).noteAudioTurnedOffLocked(elapsedRealtime);
}
+ @UnsupportedAppUsage
public void noteVideoOnLocked(int uid) {
uid = mapUid(uid);
final long elapsedRealtime = mClocks.elapsedRealtime();
@@ -5481,6 +5500,7 @@
getUidStatsLocked(uid).noteVideoTurnedOnLocked(elapsedRealtime);
}
+ @UnsupportedAppUsage
public void noteVideoOffLocked(int uid) {
if (mVideoOnNesting == 0) {
return;
@@ -5956,6 +5976,7 @@
int mWifiFullLockNesting = 0;
+ @UnsupportedAppUsage
public void noteFullWifiLockAcquiredLocked(int uid) {
final long elapsedRealtime = mClocks.elapsedRealtime();
final long uptime = mClocks.uptimeMillis();
@@ -5969,6 +5990,7 @@
getUidStatsLocked(uid).noteFullWifiLockAcquiredLocked(elapsedRealtime);
}
+ @UnsupportedAppUsage
public void noteFullWifiLockReleasedLocked(int uid) {
final long elapsedRealtime = mClocks.elapsedRealtime();
final long uptime = mClocks.uptimeMillis();
@@ -6024,6 +6046,7 @@
int mWifiMulticastNesting = 0;
+ @UnsupportedAppUsage
public void noteWifiMulticastEnabledLocked(int uid) {
uid = mapUid(uid);
final long elapsedRealtime = mClocks.elapsedRealtime();
@@ -6044,6 +6067,7 @@
getUidStatsLocked(uid).noteWifiMulticastEnabledLocked(elapsedRealtime);
}
+ @UnsupportedAppUsage
public void noteWifiMulticastDisabledLocked(int uid) {
uid = mapUid(uid);
final long elapsedRealtime = mClocks.elapsedRealtime();
@@ -6240,6 +6264,7 @@
}
}
+ @UnsupportedAppUsage
@Override public long getScreenOnTime(long elapsedRealtimeUs, int which) {
return mScreenOnTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
}
@@ -6256,6 +6281,7 @@
return mScreenDozeTimer.getCountLocked(which);
}
+ @UnsupportedAppUsage
@Override public long getScreenBrightnessTime(int brightnessBin,
long elapsedRealtimeUs, int which) {
return mScreenBrightnessTimer[brightnessBin].getTotalTimeLocked(
@@ -6365,6 +6391,7 @@
return (long) energyUsedMaMs;
}
+ @UnsupportedAppUsage
@Override public long getPhoneOnTime(long elapsedRealtimeUs, int which) {
return mPhoneOnTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
}
@@ -6373,12 +6400,14 @@
return mPhoneOnTimer.getCountLocked(which);
}
+ @UnsupportedAppUsage
@Override public long getPhoneSignalStrengthTime(int strengthBin,
long elapsedRealtimeUs, int which) {
return mPhoneSignalStrengthsTimer[strengthBin].getTotalTimeLocked(
elapsedRealtimeUs, which);
}
+ @UnsupportedAppUsage
@Override public long getPhoneSignalScanningTime(
long elapsedRealtimeUs, int which) {
return mPhoneSignalScanningTimer.getTotalTimeLocked(
@@ -6389,6 +6418,7 @@
return mPhoneSignalScanningTimer;
}
+ @UnsupportedAppUsage
@Override public int getPhoneSignalStrengthCount(int strengthBin, int which) {
return mPhoneSignalStrengthsTimer[strengthBin].getCountLocked(which);
}
@@ -6397,12 +6427,14 @@
return mPhoneSignalStrengthsTimer[strengthBin];
}
+ @UnsupportedAppUsage
@Override public long getPhoneDataConnectionTime(int dataType,
long elapsedRealtimeUs, int which) {
return mPhoneDataConnectionsTimer[dataType].getTotalTimeLocked(
elapsedRealtimeUs, which);
}
+ @UnsupportedAppUsage
@Override public int getPhoneDataConnectionCount(int dataType, int which) {
return mPhoneDataConnectionsTimer[dataType].getCountLocked(which);
}
@@ -6411,6 +6443,7 @@
return mPhoneDataConnectionsTimer[dataType];
}
+ @UnsupportedAppUsage
@Override public long getMobileRadioActiveTime(long elapsedRealtimeUs, int which) {
return mMobileRadioActiveTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
}
@@ -6441,6 +6474,7 @@
return mWifiMulticastWakelockTimer.getCountLocked(which);
}
+ @UnsupportedAppUsage
@Override public long getWifiOnTime(long elapsedRealtimeUs, int which) {
return mWifiOnTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
}
@@ -6449,6 +6483,7 @@
return mWifiActiveTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
}
+ @UnsupportedAppUsage
@Override public long getGlobalWifiRunningTime(long elapsedRealtimeUs, int which) {
return mGlobalWifiRunningTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
}
@@ -6546,6 +6581,7 @@
}
@Override
+ @UnsupportedAppUsage
public long getNetworkActivityBytes(int type, int which) {
if (type >= 0 && type < mNetworkByteActivityCounters.length) {
return mNetworkByteActivityCounters[type].getCountLocked(which);
@@ -6588,6 +6624,7 @@
return mOnBattery;
}
+ @UnsupportedAppUsage
@Override public SparseArray<? extends BatteryStats.Uid> getUidStats() {
return mUidStats;
}
@@ -7005,6 +7042,7 @@
}
@Override
+ @UnsupportedAppUsage
public ArrayMap<String, ? extends BatteryStats.Uid.Wakelock> getWakelockStats() {
return mWakelockStats.getMap();
}
@@ -7030,11 +7068,13 @@
}
@Override
+ @UnsupportedAppUsage
public SparseArray<? extends BatteryStats.Uid.Sensor> getSensorStats() {
return mSensorStats;
}
@Override
+ @UnsupportedAppUsage
public ArrayMap<String, ? extends BatteryStats.Uid.Proc> getProcessStats() {
return mProcessStats;
}
@@ -7045,6 +7085,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getUid() {
return mUid;
}
@@ -7432,6 +7473,7 @@
}
@Override
+ @UnsupportedAppUsage
public long getWifiRunningTime(long elapsedRealtimeUs, int which) {
if (mWifiRunningTimer == null) {
return 0;
@@ -7448,6 +7490,7 @@
}
@Override
+ @UnsupportedAppUsage
public long getWifiScanTime(long elapsedRealtimeUs, int which) {
if (mWifiScanTimer == null) {
return 0;
@@ -8893,6 +8936,7 @@
}
@Override
+ @UnsupportedAppUsage
public Timer getWakeTime(int type) {
switch (type) {
case WAKE_TYPE_FULL: return mTimerFull;
@@ -8962,6 +9006,7 @@
}
@Override
+ @UnsupportedAppUsage
public Timer getSensorTime() {
return mTimer;
}
@@ -8975,6 +9020,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getHandle() {
return mHandle;
}
@@ -9231,6 +9277,7 @@
readExcessivePowerFromParcelLocked(in);
}
+ @UnsupportedAppUsage
public void addCpuTimeLocked(int utime, int stime) {
addCpuTimeLocked(utime, stime, mBsi.mOnBatteryTimeBase.isRunning());
}
@@ -9242,10 +9289,12 @@
}
}
+ @UnsupportedAppUsage
public void addForegroundTimeLocked(long ttime) {
mForegroundTime += ttime;
}
+ @UnsupportedAppUsage
public void incStartsLocked() {
mStarts++;
}
@@ -9264,6 +9313,7 @@
}
@Override
+ @UnsupportedAppUsage
public long getUserTime(int which) {
long val = mUserTime;
if (which == STATS_CURRENT) {
@@ -9275,6 +9325,7 @@
}
@Override
+ @UnsupportedAppUsage
public long getSystemTime(int which) {
long val = mSystemTime;
if (which == STATS_CURRENT) {
@@ -9286,6 +9337,7 @@
}
@Override
+ @UnsupportedAppUsage
public long getForegroundTime(int which) {
long val = mForegroundTime;
if (which == STATS_CURRENT) {
@@ -9297,6 +9349,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getStarts(int which) {
int val = mStarts;
if (which == STATS_CURRENT) {
@@ -9621,6 +9674,7 @@
return mStartTime + batteryUptime - mRunningSince;
}
+ @UnsupportedAppUsage
public void startLaunchedLocked() {
if (!mLaunched) {
mLaunches++;
@@ -9629,6 +9683,7 @@
}
}
+ @UnsupportedAppUsage
public void stopLaunchedLocked() {
if (mLaunched) {
long time = mBsi.getBatteryUptimeLocked() - mLaunchedSince;
@@ -9641,6 +9696,7 @@
}
}
+ @UnsupportedAppUsage
public void startRunningLocked() {
if (!mRunning) {
mStarts++;
@@ -9649,6 +9705,7 @@
}
}
+ @UnsupportedAppUsage
public void stopRunningLocked() {
if (mRunning) {
long time = mBsi.getBatteryUptimeLocked() - mRunningSince;
@@ -9661,6 +9718,7 @@
}
}
+ @UnsupportedAppUsage
public BatteryStatsImpl getBatteryStats() {
return mBsi;
}
@@ -10160,6 +10218,7 @@
mUserInfoProvider = userInfoProvider;
}
+ @UnsupportedAppUsage
public BatteryStatsImpl(Parcel p) {
this(new SystemClocks(), p);
}
@@ -10601,6 +10660,7 @@
}
@Override
+ @UnsupportedAppUsage
public boolean startIteratingHistoryLocked() {
mBatteryStatsHistory.startIteratingHistory();
mReadOverflow = false;
@@ -10641,6 +10701,7 @@
}
@Override
+ @UnsupportedAppUsage
public boolean getNextHistoryLocked(HistoryItem out) {
Parcel p = mBatteryStatsHistory.getNextParcel(out);
if (p == null) {
@@ -10674,6 +10735,7 @@
return mStartCount;
}
+ @UnsupportedAppUsage
public boolean isOnBattery() {
return mOnBattery;
}
@@ -12694,10 +12756,12 @@
}
}
+ @UnsupportedAppUsage
public long getAwakeTimeBattery() {
return computeBatteryUptime(getBatteryUptimeLocked(), STATS_CURRENT);
}
+ @UnsupportedAppUsage
public long getAwakeTimePlugged() {
return (mClocks.uptimeMillis() * 1000) - getAwakeTimeBattery();
}
@@ -12723,11 +12787,13 @@
}
@Override
+ @UnsupportedAppUsage
public long computeBatteryUptime(long curTime, int which) {
return mOnBatteryTimeBase.computeUptime(curTime, which);
}
@Override
+ @UnsupportedAppUsage
public long computeBatteryRealtime(long curTime, int which) {
return mOnBatteryTimeBase.computeRealtime(curTime, which);
}
@@ -12781,6 +12847,7 @@
}
@Override
+ @UnsupportedAppUsage
public long computeBatteryTimeRemaining(long curTime) {
if (!mOnBattery) {
return -1;
@@ -12979,11 +13046,13 @@
}
@Override
+ @UnsupportedAppUsage
public long getBatteryRealtime(long curTime) {
return mOnBatteryTimeBase.getRealtime(curTime);
}
@Override
+ @UnsupportedAppUsage
public int getDischargeStartLevel() {
synchronized(this) {
return getDischargeStartLevelLocked();
@@ -12995,6 +13064,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getDischargeCurrentLevel() {
synchronized(this) {
return getDischargeCurrentLevelLocked();
@@ -13028,6 +13098,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getDischargeAmount(int which) {
int dischargeAmount = which == STATS_SINCE_CHARGED
? getHighDischargeAmountSinceCharge()
@@ -13039,6 +13110,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getDischargeAmountScreenOn() {
synchronized(this) {
int val = mDischargeAmountScreenOn;
@@ -13063,6 +13135,7 @@
}
@Override
+ @UnsupportedAppUsage
public int getDischargeAmountScreenOff() {
synchronized(this) {
int val = mDischargeAmountScreenOff;
@@ -13115,6 +13188,7 @@
/**
* Retrieve the statistics object for a particular uid, creating if needed.
*/
+ @UnsupportedAppUsage
public Uid getUidStatsLocked(int uid) {
Uid u = mUidStats.get(uid);
if (u == null) {
@@ -13159,6 +13233,7 @@
/**
* Remove the statistics object for a particular uid.
*/
+ @UnsupportedAppUsage
public void removeUidStatsLocked(int uid) {
final Uid u = mUidStats.get(uid);
if (u != null) {
@@ -13172,6 +13247,7 @@
* Retrieve the statistics object for a particular process, creating
* if needed.
*/
+ @UnsupportedAppUsage
public Uid.Proc getProcessStatsLocked(int uid, String name) {
uid = mapUid(uid);
Uid u = getUidStatsLocked(uid);
@@ -13182,6 +13258,7 @@
* Retrieve the statistics object for a particular process, creating
* if needed.
*/
+ @UnsupportedAppUsage
public Uid.Pkg getPackageStatsLocked(int uid, String pkg) {
uid = mapUid(uid);
Uid u = getUidStatsLocked(uid);
@@ -13192,6 +13269,7 @@
* Retrieve the statistics object for a particular service, creating
* if needed.
*/
+ @UnsupportedAppUsage
public Uid.Pkg.Serv getServiceStatsLocked(int uid, String pkg, String name) {
uid = mapUid(uid);
Uid u = getUidStatsLocked(uid);
@@ -13523,6 +13601,7 @@
}
}
+ @UnsupportedAppUsage
public void readLocked() {
if (mDailyFile != null) {
readDailyStatsLocked();
@@ -15146,6 +15225,7 @@
}
}
+ @UnsupportedAppUsage
public static final Parcelable.Creator<BatteryStatsImpl> CREATOR =
new Parcelable.Creator<BatteryStatsImpl>() {
public BatteryStatsImpl createFromParcel(Parcel in) {