Skip to content

Commit

Permalink
Use class canonical name for PARTIAL_WAKE_LOCK tag (#24673)
Browse files Browse the repository at this point in the history
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 88dbb45
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 88dbb45

Please sign in to comment.