Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d08302cd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Handle crash when SecurityException"" into main

parents 464c2d69 6b5daf18
Loading
Loading
Loading
Loading
+6 −27
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
@@ -297,21 +296,11 @@ class CustomizationProviderClientImpl(
    }

    override fun observeSlots(): Flow<List<CustomizationProviderClient.Slot>> {
        return try {
            observeUri(Contract.LockScreenQuickAffordances.SlotTable.URI).map { querySlots() }
        } catch (e: SecurityException) {
            Log.e(TAG, "Failed to observe the slots", e)
            emptyFlow()
        }
        return observeUri(Contract.LockScreenQuickAffordances.SlotTable.URI).map { querySlots() }
    }

    override fun observeFlags(): Flow<List<CustomizationProviderClient.Flag>> {
        return try {
            observeUri(Contract.FlagsTable.URI).map { queryFlags() }
        } catch (e: SecurityException) {
            Log.e(TAG, "Failed to observe the flags", e)
            emptyFlow()
        }
        return observeUri(Contract.FlagsTable.URI).map { queryFlags() }
    }

    override suspend fun queryAffordances(): List<CustomizationProviderClient.Affordance> {
@@ -405,14 +394,9 @@ class CustomizationProviderClientImpl(
    }

    override fun observeAffordances(): Flow<List<CustomizationProviderClient.Affordance>> {
        return try {
            observeUri(Contract.LockScreenQuickAffordances.AffordanceTable.URI).map {
        return observeUri(Contract.LockScreenQuickAffordances.AffordanceTable.URI).map {
            queryAffordances()
        }
        } catch (e: SecurityException) {
            Log.e(TAG, "Failed to observe the affordances", e)
            emptyFlow()
        }
    }

    override suspend fun querySelections(): List<CustomizationProviderClient.Selection> {
@@ -464,14 +448,9 @@ class CustomizationProviderClientImpl(
    }

    override fun observeSelections(): Flow<List<CustomizationProviderClient.Selection>> {
        return try {
            observeUri(Contract.LockScreenQuickAffordances.SelectionTable.URI).map {
        return observeUri(Contract.LockScreenQuickAffordances.SelectionTable.URI).map {
            querySelections()
        }
        } catch (e: SecurityException) {
            Log.e(TAG, "Failed to observe the selections", e)
            emptyFlow()
        }
    }

    override suspend fun deleteSelection(slotId: String, affordanceId: String) {