This repository has been archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EuiccGoogle: skip Resources.getText() filtering for getApplicationLabel
PackageManager.getApplicationLabel() calls Resources.getText(), which in EuiccGoogle replaces strings that contain "Google" with an empty string. This replacement is done to remove a misleading string about info being sent to Google. During Google Fi activation, Google Fi app invokes EuiccGoogle. EuiccGoogle then checks for caller app label and aborts activation if it's empty. Since the Google Fi app label contains "Google", it was always replaced with an empty string before this change, which broke Google Fi activation.
- Loading branch information
1 parent
b7e22b1
commit 5af848e
Showing
3 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.android.internal.ext; | ||
|
||
public class EuiccGoogleHooks { | ||
|
||
private static final ThreadLocal<Integer> resourceFilteringSuppressionCounter = | ||
ThreadLocal.withInitial(() -> Integer.valueOf(0)); | ||
|
||
public static boolean isResourceFilteringSuppressed() { | ||
return resourceFilteringSuppressionCounter.get() > 0; | ||
} | ||
|
||
public static class SuppressResourceFiltering implements AutoCloseable { | ||
|
||
public SuppressResourceFiltering() { | ||
var tl = resourceFilteringSuppressionCounter; | ||
int newValue = tl.get() + 1; | ||
if (newValue <= 0) { | ||
throw new IllegalStateException(); | ||
} | ||
tl.set(newValue); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
var tl = resourceFilteringSuppressionCounter; | ||
int newValue = tl.get() - 1; | ||
if (newValue < 0) { | ||
throw new IllegalStateException(); | ||
} | ||
tl.set(newValue); | ||
} | ||
} | ||
} |