Skip to content
Permalink
Browse files

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: #24673

Differential Revision: D15164306

Pulled By: cpojer

fbshipit-source-id: fd65f9e5250c180b0053940b17877fe36af5d48b
  • Loading branch information...
timwangdev authored and facebook-github-bot committed May 1, 2019
1 parent bdb1d43 commit 88dbb4558cd10f129f2c31e3b0b872924aba5416
Showing with 1 addition and 1 deletion.
  1. +1 −1 ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java
@@ -75,7 +75,7 @@ public static void acquireWakeLockNow(Context context) {
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();
}

0 comments on commit 88dbb45

Please sign in to comment.
You can’t perform that action at this time.