Skip to content

Commit 98ba33c

Browse files
authored
fix: fallback with persistent=false (#404)
1 parent 8ceda82 commit 98ba33c

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

README.en.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Pixel IMS: Enable VoLTE on Tensor Pixel devices
22

3+
## **Notice:** Changes may not persist across reboot on devices with Android 16 QPR2 Beta 3 or newer
4+
Due to security measures applied on Android on behalf of Google, you may have to reapply the patch across every reboot. Check FAQ section at the very bottom for more.
5+
36
## Troubleshooting
47

58
Refer [here](https://github.com/kyujin-cho/pixel-volte-patch/blob/main/docs/troubleshooting.en.md).
@@ -110,7 +113,8 @@ For more information, you can make use of Pixel's internal application. To open
110113

111114
### Do I have to do this every time I reboot the phone?
112115

113-
No.
116+
- Devices running **Android 16 QPR2 Beta 3** or newer: [Yes](https://github.com/kyujin-cho/pixel-volte-patch/issues/398).
117+
- Others: No.
114118

115119
### Do I have to do this after updating my Pixel?
116120

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
English version available [here](https://github.com/kyujin-cho/pixel-volte-patch/blob/main/README.en.md).
44

5+
## 주의: Android 16 QPR2 Beta 3 이상의 버전을 사용 중인 경우
6+
구글 보안 패치의 도입으로 인해 Android 16 QPR2 Beta 3 이상의 버전에서는 해당 애플리케이션을 이용한 패치가 재부팅 시 초기화 될 수 있습니다. 자세한 사항은 아래의 "자주 묻는 질문" 을 참고하세요.
7+
58
## 트러블슈팅
69

710
[이곳](https://github.com/kyujin-cho/pixel-volte-patch/blob/main/docs/troubleshooting.md)을 참조하세요.
@@ -108,7 +111,8 @@ English version available [here](https://github.com/kyujin-cho/pixel-volte-patch
108111

109112
### 해당 패치는 재부팅 시마다 다시 실행하여야 하나요?
110113

111-
아니오.
114+
- 장치가 Android 16 QPR2 Beta 3 이상의 소프트웨어 버전에서 작동할 경우: [](https://github.com/kyujin-cho/pixel-volte-patch/issues/398).
115+
- 그렇지 않을 경우: 아니오.
112116

113117
### 해당 패치는 시스템 업데이트 시마다 다시 실행하여야 하나요?
114118

app/src/main/java/dev/bluehouse/enablevolte/BrokerInstrumentation.kt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ class BrokerInstrumentation : Instrumentation() {
2626
val configurationManager = this.context.getSystemService(CarrierConfigManager::class.java)
2727
val overrideValues = toPersistableBundle(arguments)
2828

29-
configurationManager.overrideConfig(subId, overrideValues, true)
29+
try {
30+
configurationManager.overrideConfig(subId, overrideValues, true)
31+
} catch (e: SecurityException) {
32+
if (e.message?.contains("overrideConfig with persistent=true only can be invoked by system app") == true) {
33+
configurationManager.overrideConfig(subId, overrideValues, false)
34+
} else {
35+
throw e
36+
}
37+
}
3038
} finally {
3139
Log.i(TAG, "applyConfig done")
3240
am.stopDelegateShellPermissionIdentity()
@@ -41,7 +49,15 @@ class BrokerInstrumentation : Instrumentation() {
4149
try {
4250
val configurationManager = this.context.getSystemService(CarrierConfigManager::class.java)
4351

44-
configurationManager.overrideConfig(subId, null, true)
52+
try {
53+
configurationManager.overrideConfig(subId, null, true)
54+
} catch (e: SecurityException) {
55+
if (e.message?.contains("overrideConfig with persistent=true only can be invoked by system app") == true) {
56+
configurationManager.overrideConfig(subId, null, false)
57+
} else {
58+
throw e
59+
}
60+
}
4561
} finally {
4662
Log.i(TAG, "clearConfig done")
4763
am.stopDelegateShellPermissionIdentity()

0 commit comments

Comments
 (0)