• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.base;
6 
7 import android.os.Build;
8 import android.os.PowerManager;
9 
10 import androidx.annotation.RequiresApi;
11 
12 /**
13  * Utility class to use new APIs that were added in Q (API level 29). These need to exist in a
14  * separate class so that Android framework can successfully verify the PowerMonitor class without
15  * encountering the new APIs.
16  */
17 @RequiresApi(Build.VERSION_CODES.Q)
18 public final class PowerMonitorForQ {
PowerMonitorForQ()19     private PowerMonitorForQ() {}
20 
addThermalStatusListener(PowerManager powerManager)21     public static void addThermalStatusListener(PowerManager powerManager) {
22         powerManager.addThermalStatusListener(
23                 new PowerManager.OnThermalStatusChangedListener() {
24                     @Override
25                     public void onThermalStatusChanged(int status) {
26                         PowerMonitorJni.get().onThermalStatusChanged(status);
27                     }
28                 });
29     }
30 }
31