0

I'm working on power optimization.

Is it possible to call powerHint in PowerManagerService from an application?

How can I call it? Is there any way to call the method via below pm?

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
Vini.g.fer
  • 11,639
  • 16
  • 61
  • 90

2 Answers2

0

IPowerManager.powerHint() method is just a wrapper function to PowerHAL's powerHint() through nativePowerHint().

static void nativeSendPowerHint(JNIEnv *env, jclass clazz, jint hintId, jint data)
{
    int data_param = data;

    if (gPowerModule && gPowerModule->powerHint) {
        if(data)
            gPowerModule->powerHint(gPowerModule, (power_hint_t)hintId, &data_param);
        else {
            gPowerModule->powerHint(gPowerModule, (power_hint_t)hintId, NULL);
        }
    }
}

If you want the HAL to do something, you should implement your own actions associated with hintId like POWER_HINT_INTERACTION, POWER_HINT_LOW_POWER, and so on.

I think that calling powerHint() directly is a part of SDK implementation area. Refer to these talks.

Youngdo Lee
  • 158
  • 6
0

It's not a part of SDK. Thus an apk can't call it. It's manage automatically. If you want to manage it, modify your target...

powerHint is used for busting the performance on user interactivity or graphics activity going on (UI / UX animations)

There isn’t much more to say other than you should look a the example implementations of powerHAL’s available to get an idea on how people have implemented it for specific hardware and mimic them for yours. When ready you simply add “power.” to the PRODUCT_PACKAGES list in your device’s AndroidProducts.mk (or a mk file that AndroidProducts includes) and you have a Power HAL.

From http://thegnar.org/sync/?p=275

Community
  • 1
  • 1