dev-harsh1998 / ota

20 stars 1 forks source link

Using the Settings app, then Network & Internet -> Internet -> Data usage without mobile network crashes the Settings app #9

Closed joergjahnke closed 1 month ago

joergjahnke commented 2 months ago

The exception showing in Logcat is

FATAL EXCEPTION: main Process: com.android.settings, PID: 9867 java.lang.IllegalStateException: telephony service is null. at android.telephony.TelephonyManager.isDataEnabledForReason(TelephonyManager.java:14333) at android.telephony.TelephonyManager.isDataEnabledForReason(TelephonyManager.java:14324) at com.android.settings.datausage.lib.BillingCycleRepository.isDataEnabled(BillingCycleRepository.kt:50) at com.android.settings.datausage.lib.BillingCycleRepository.isModifiable(BillingCycleRepository.kt:39) at com.android.settings.datausage.DataUsageList.isBillingCycleModifiable(DataUsageList.kt:160) at com.android.settings.datausage.DataUsageList.updatePolicy(DataUsageList.kt:154) at com.android.settings.datausage.DataUsageList.access$updatePolicy(DataUsageList.kt:48) at com.android.settings.datausage.DataUsageList$onViewCreated$1.invokeSuspend(DataUsageList.kt:104) at com.android.settings.datausage.DataUsageList$onViewCreated$1.invoke(DataUsageList.kt:0) at com.android.settings.datausage.DataUsageList$onViewCreated$1.invoke(DataUsageList.kt:0) at kotlinx.coroutines.flow.FlowKtMergeKt$mapLatest$1.invokeSuspend(Merge.kt:217) at kotlinx.coroutines.flow.FlowKtMergeKt$mapLatest$1.invoke(Merge.kt:0) at kotlinx.coroutines.flow.FlowKtMergeKt$mapLatest$1.invoke(Merge.kt:0) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:34) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Merge.kt:0) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Merge.kt:0) at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:44) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKtBuilders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47) at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1.emit(Merge.kt:33) at kotlinx.coroutines.flow.FlowKtChannelsKt.emitAllImpl$FlowKtChannelsKt(Channels.kt:37) at kotlinx.coroutines.flow.FlowKtChannelsKt.access$emitAllImpl$FlowKtChannelsKt(Channels.kt:1) at kotlinx.coroutines.flow.FlowKtChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt:0) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:256) at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:191) at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:163) at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474) at kotlinx.coroutines.CancellableContinuationImpl.completeResume(CancellableContinuationImpl.kt:590) at kotlinx.coroutines.channels.BufferedChannelKt.tryResume0(BufferedChannel.kt:2896) at kotlinx.coroutines.channels.BufferedChannelKt.access$tryResume0(BufferedChannel.kt:1) at kotlinx.coroutines.channels.BufferedChannel$BufferedChannelIterator.tryResumeHasNext(BufferedChannel.kt:1689) at kotlinx.coroutines.channels.BufferedChannel.tryResumeReceiver(BufferedChannel.kt:642) at kotlinx.coroutines.channels.BufferedChannel.updateCellSend(BufferedChannel.kt:458) at kotlinx.coroutines.channels.BufferedChannel.access$updateCellSend(BufferedChannel.kt:36) at kotlinx.coroutines.channels.BufferedChannel.send$suspendImpl(BufferedChannel.kt:304) at kotlinx.coroutines.channels.BufferedChannel.send(BufferedChannel.kt:0) at kotlinx.coroutines.channels.ChannelCoroutine.send(ChannelCoroutine.kt:0) at kotlinx.coroutines.flow.internal.SendingCollector.emit(SendingCollector.kt:19) 2024-08-23 14:36:32.372 9867-9867 AndroidRuntime com.android.settings E at kotlinx.coroutines.flow.FlowKtChannelsKt.emitAllImpl$FlowKtChannelsKt(Channels.kt:37) at kotlinx.coroutines.flow.FlowKtChannelsKt.access$emitAllImpl$FlowKtChannelsKt(Channels.kt:1) at kotlinx.coroutines.flow.FlowKtChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt:0) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at android.os.Handler.handleCallback(Handler.java:959) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8592) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@e529d8e, Dispatchers.Main.immediate]

To me it looks like this would currently only work with the telephony service available. And I don't have a SIM card in the device.

dev-harsh1998 commented 2 months ago

Well there's no simcard support in the device

dev-harsh1998 commented 2 months ago

Seems like removing https://github.com/dev-harsh1998/android_device_xiaomi_nabu/blob/lineage-21/RemovePackages/Android.mk#L14 should fix the crashing bug

joergjahnke commented 2 months ago

Thanks for looking into this. I'll double check once a new version is available.

dev-harsh1998 commented 1 month ago

Resolved, should work fine from future builds, thanks for the logs and info @joergjahnke