forked from aosp-mirror/platform_frameworks_base
-
Notifications
You must be signed in to change notification settings - Fork 63
add per-app setting for hiding carrier/network information #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
maade93791
wants to merge
7
commits into
GrapheneOS:16-qpr2
Choose a base branch
from
maade93791:16-qpr2-carrier-info
base: 16-qpr2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9f12f77
initial infrastructure for hiding carrier info
maade93791 0a2cdfa
filter carrier/network country sources
maade93791 4d27ae9
add extended sysprop override to zygote ExtraArgs
maade93791 5f86285
add shouldHideCarrierInfoForUid helper for overrides inside of PhoneI…
maade93791 3a4b346
HardeningTest: move GosPackageState methods to a new TestUtils class
maade93791 265231a
add HideCarrierInfo tests
maade93791 9befca8
HideCarrierInfoTest: include bionic sysprop override tests
maade93791 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,47 @@ | ||
| package android.ext.carrierinfo; | ||
|
|
||
| import android.app.AppGlobals; | ||
| import android.app.Application; | ||
| import android.content.Context; | ||
| import android.content.pm.ApplicationInfo; | ||
| import android.content.pm.GosPackageState; | ||
| import android.ext.settings.app.AswHideCarrierInfo; | ||
| import android.os.UserHandle; | ||
|
|
||
| /** @hide */ | ||
| public class HideCarrierInfo { | ||
| /** @hide */ | ||
| public static final int FLAG_HIDE_CARRIER_INFO = 1; | ||
|
|
||
| private static volatile int flags; | ||
|
|
||
| /** @hide */ | ||
| public static int getAppBindFlags(Context ctx, int userId, ApplicationInfo appInfo, | ||
| GosPackageState gosPs) { | ||
| if (AswHideCarrierInfo.I.get(ctx, userId, appInfo, gosPs)) { | ||
| return FLAG_HIDE_CARRIER_INFO; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| /** @hide */ | ||
| public static void handleAppBindFlags(int v) { | ||
| flags = v; | ||
| } | ||
|
|
||
| /** @hide */ | ||
| public static void onGosPackageStateChanged(Context ctx, GosPackageState gosPs) { | ||
| Application app = AppGlobals.getInitialApplication(); | ||
| if (app == null) { | ||
| return; | ||
| } | ||
| flags = getAppBindFlags(ctx, UserHandle.myUserId(), app.getApplicationInfo(), gosPs); | ||
| } | ||
|
|
||
| /** @hide */ | ||
| public static boolean isEnabled() { | ||
| return (flags & FLAG_HIDE_CARRIER_INFO) != 0; | ||
| } | ||
|
|
||
| private HideCarrierInfo() {} | ||
| } |
This file contains hidden or 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
34 changes: 34 additions & 0 deletions
34
core/java/android/ext/settings/app/AswHideCarrierInfo.java
This file contains hidden or 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,34 @@ | ||
| package android.ext.settings.app; | ||
|
|
||
| import android.content.Context; | ||
| import android.content.pm.ApplicationInfo; | ||
| import android.content.pm.GosPackageState; | ||
| import android.content.pm.GosPackageStateFlag; | ||
| import android.ext.settings.ExtSettings; | ||
|
|
||
| /** @hide */ | ||
| public class AswHideCarrierInfo extends AppSwitch { | ||
| public static final AswHideCarrierInfo I = new AswHideCarrierInfo(); | ||
|
|
||
| private AswHideCarrierInfo() { | ||
| gosPsFlagNonDefault = GosPackageStateFlag.HIDE_CARRIER_INFO_NON_DEFAULT; | ||
| gosPsFlag = GosPackageStateFlag.HIDE_CARRIER_INFO; | ||
| } | ||
|
|
||
| @Override | ||
| public Boolean getImmutableValue(Context ctx, int userId, ApplicationInfo appInfo, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Methods that may return
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. base AppSwitch class doesnt declare that, didnt include it for consistency |
||
| GosPackageState ps, StateInfo si) { | ||
| if (appInfo.isSystemApp()) { | ||
| si.immutabilityReason = IR_IS_SYSTEM_APP; | ||
| return false; | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean getDefaultValueInner(Context ctx, int userId, ApplicationInfo appInfo, | ||
| GosPackageState ps, StateInfo si) { | ||
| si.defaultValueReason = DVR_DEFAULT_SETTING; | ||
| return ExtSettings.HIDE_CARRIER_INFO_BY_DEFAULT.get(ctx, userId); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use more descriptive var names, I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other AppSwtich implementations use this naming scheme (e.g. AswBlockPlayIntegrityApi, AswDenyNativeDebug and so on), i went off that.