mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-07-01 09:02:05 +00:00
![Tad](/assets/img/avatar_default.png)
wgetc873988898
.patch -O telecomm-01.patch wget0fb5786dbf
.patch -O mediaprovider-01.patch wget1a4b9ef510
.patch -O wifi-01.patch wget364a1d9962
.patch -O bluetooth-01.patch wget87a06448b9
.patch -O settings-01.patch wgetaaba724a68
.patch -O settings-02.patch wget507304e1f5
.patch -O native-01.patch wget89489ff5dd
.patch -O base-01.patch wgetd1765c4715
.patch -O base-02.patch wgetcbb1a0ecd6
.patch -O base-03.patch wget4725772c0b
.patch -O base-04.patch wget19747f6923
.patch -O base-05.patch wgete7a1aa9ed0
.patch -O base-06.patch wget922a7860b1
.patch -O base-07.patch wgeted183ed912
.patch -O base-08.patch wgetc6fbe1330a
.patch -O base-09.patch wget9141cac175
.patch -O base-10.patch wget41235bcc67
.patch -O av-01.patch wgeta89f704701
.patch -O av-02.patch wget6d7cd80d77
.patch -O av-03.patch wget75fc175a08
.patch -O av-04.patch wgetb023ec300f
.patch -O av-05.patch wgetc8117d1539
.patch -O av-06.patch wgetf06d23d824
.patch -O av-07.patch wget9c7408ab07
.patch -O av-08.patch wgetcfbfcefb3c
.patch -O launcher-01.patch wget4a27a7f162
.patch -O libxml-01.patch Signed-off-by: Tad <tad@spotco.us>
68 lines
2.4 KiB
Diff
68 lines
2.4 KiB
Diff
From 87a06448b96e1ccd2403ae5c90b15efdd8585444 Mon Sep 17 00:00:00 2001
|
|
From: Weng Su <wengsu@google.com>
|
|
Date: Fri, 7 Jul 2023 19:52:04 +0800
|
|
Subject: [PATCH] [RESTRICT AUTOMERGE] Restrict ApnEditor settings
|
|
|
|
- Finish ApnEditor settings if user is not an admin
|
|
|
|
- Finish ApnEditor settings if user has DISALLOW_CONFIG_MOBILE_NETWORKS restriction
|
|
|
|
Bug: 279902472
|
|
Test: manual test
|
|
atest -c ApnEditorTest
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ef2fd5b7cd74426568e8e82fb0dcddbfdaa943bf)
|
|
Merged-In: Iecdbbff7e21dfb11e3ba385858747a220cfd3e04
|
|
Change-Id: Iecdbbff7e21dfb11e3ba385858747a220cfd3e04
|
|
---
|
|
.../settings/network/apn/ApnEditor.java | 23 +++++++++++++++++++
|
|
1 file changed, 23 insertions(+)
|
|
|
|
diff --git a/src/com/android/settings/network/apn/ApnEditor.java b/src/com/android/settings/network/apn/ApnEditor.java
|
|
index bfb49434378..afaf9bc3f8b 100644
|
|
--- a/src/com/android/settings/network/apn/ApnEditor.java
|
|
+++ b/src/com/android/settings/network/apn/ApnEditor.java
|
|
@@ -25,6 +25,7 @@
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.os.PersistableBundle;
|
|
+import android.os.UserManager;
|
|
import android.provider.Telephony;
|
|
import android.telephony.CarrierConfigManager;
|
|
import android.telephony.SubscriptionInfo;
|
|
@@ -281,6 +282,11 @@ public class ApnEditor extends SettingsPreferenceFragment
|
|
@Override
|
|
public void onCreate(Bundle icicle) {
|
|
super.onCreate(icicle);
|
|
+ if (isUserRestricted()) {
|
|
+ Log.e(TAG, "This setting isn't available due to user restriction.");
|
|
+ finish();
|
|
+ return;
|
|
+ }
|
|
|
|
setLifecycleForAllControllers();
|
|
|
|
@@ -1453,6 +1459,23 @@ ApnData getApnDataFromUri(Uri uri) {
|
|
return apnData;
|
|
}
|
|
|
|
+ @VisibleForTesting
|
|
+ boolean isUserRestricted() {
|
|
+ UserManager userManager = getContext().getSystemService(UserManager.class);
|
|
+ if (userManager == null) {
|
|
+ return false;
|
|
+ }
|
|
+ if (!userManager.isAdminUser()) {
|
|
+ Log.e(TAG, "User is not an admin");
|
|
+ return true;
|
|
+ }
|
|
+ if (userManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
|
+ Log.e(TAG, "User is not allowed to configure mobile network");
|
|
+ return true;
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
+
|
|
@VisibleForTesting
|
|
static class ApnData {
|
|
/**
|