Use class canonical name for PARTIAL_WAKE_LOCK tag (#24673)

Summary:
When acquiring the `PARTIAL_WAKE_LOCK`, Android requires a tag to identify the source, normally the class name. This tag will show on dumpsys call and Google Play developer console.

`getSimpleName` will work fine as long as not enable ProGuard, in my case, it transformed the class name to just `"c"`, and I take my half day to find where the `c` comes from.

`getCanonicalName` will add the package path, which is more friendly for developers.

Later we can even let the developer choose the tag name, but this will require API break changes.

[Android] [Changed] - Use class canonical name for PARTIAL_WAKE_LOCK tag
Pull Request resolved: https://github.com/facebook/react-native/pull/24673

Differential Revision: D15164306

Pulled By: cpojer

fbshipit-source-id: fd65f9e5250c180b0053940b17877fe36af5d48b
This commit is contained in:
Tim Wang
2019-05-01 02:50:52 -07:00
committed by Facebook Github Bot
parent bdb1d4377e
commit 88dbb4558c

View File

@@ -75,7 +75,7 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
Assertions.assertNotNull((PowerManager) context.getSystemService(POWER_SERVICE));
sWakeLock = powerManager.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK,
HeadlessJsTaskService.class.getSimpleName());
HeadlessJsTaskService.class.getCanonicalName());
sWakeLock.setReferenceCounted(false);
sWakeLock.acquire();
}