Merge "Add log for shouldShowBatteryAttributionList() checking"

This commit is contained in:
TreeHugger Robot
2022-02-16 06:14:08 +00:00
committed by Android (Google) Code Review

View File

@@ -36,6 +36,7 @@ import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.ArrayMap; import android.util.ArrayMap;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.Log;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference; import androidx.preference.Preference;
@@ -64,6 +65,7 @@ import java.util.List;
*/ */
public class BatteryAppListPreferenceController extends AbstractPreferenceController public class BatteryAppListPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, LifecycleObserver, OnPause, OnDestroy { implements PreferenceControllerMixin, LifecycleObserver, OnPause, OnDestroy {
private static final String TAG = "BatteryAppListPreferenceController";
@VisibleForTesting @VisibleForTesting
static final boolean USE_FAKE_DATA = false; static final boolean USE_FAKE_DATA = false;
private static final int MAX_ITEMS_TO_LIST = USE_FAKE_DATA ? 30 : 20; private static final int MAX_ITEMS_TO_LIST = USE_FAKE_DATA ? 30 : 20;
@@ -103,9 +105,14 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
PowerProfile powerProfile = new PowerProfile(context); PowerProfile powerProfile = new PowerProfile(context);
// Cheap hack to try to figure out if the power_profile.xml was populated. // Cheap hack to try to figure out if the power_profile.xml was populated.
return powerProfile.getAveragePowerForOrdinal( final double averagePowerForOrdinal = powerProfile.getAveragePowerForOrdinal(
PowerProfile.POWER_GROUP_DISPLAY_SCREEN_FULL, 0) PowerProfile.POWER_GROUP_DISPLAY_SCREEN_FULL, 0);
>= MIN_AVERAGE_POWER_THRESHOLD_MILLI_AMP; final boolean shouldShowBatteryAttributionList =
averagePowerForOrdinal >= MIN_AVERAGE_POWER_THRESHOLD_MILLI_AMP;
if (!shouldShowBatteryAttributionList) {
Log.w(TAG, "shouldShowBatteryAttributionList(): " + averagePowerForOrdinal);
}
return shouldShowBatteryAttributionList;
} }
}; };