-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12274 from nextcloud/backport/12257/stable-3.27
[stable-3.27] Fix Crash Register Broadcast
- Loading branch information
Showing
6 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/nextcloud/utils/extensions/ContextExtensions.kt
This file contains 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,39 @@ | ||
/* | ||
* Nextcloud Android client application | ||
* | ||
* @author Alper Ozturk | ||
* Copyright (C) 2023 Alper Ozturk | ||
* Copyright (C) 2023 Nextcloud GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.nextcloud.utils.extensions | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.BroadcastReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.content.IntentFilter | ||
import android.os.Build | ||
import com.owncloud.android.datamodel.ReceiverFlag | ||
|
||
@SuppressLint("UnspecifiedRegisterReceiverFlag") | ||
fun Context.registerBroadcastReceiver(receiver: BroadcastReceiver?, filter: IntentFilter, flag: ReceiverFlag): Intent? { | ||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { | ||
registerReceiver(receiver, filter, flag.getId()) | ||
} else { | ||
registerReceiver(receiver, filter) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/owncloud/android/datamodel/ReceiverFlag.kt
This file contains 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,35 @@ | ||
/* | ||
* Nextcloud Android client application | ||
* | ||
* @author Alper Ozturk | ||
* Copyright (C) 2023 Alper Ozturk | ||
* Copyright (C) 2023 Nextcloud GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.owncloud.android.datamodel | ||
|
||
import android.content.Context | ||
import android.os.Build | ||
import androidx.annotation.RequiresApi | ||
|
||
enum class ReceiverFlag { | ||
NotExported; | ||
|
||
@RequiresApi(Build.VERSION_CODES.TIRAMISU) | ||
fun getId(): Int { | ||
return Context.RECEIVER_NOT_EXPORTED | ||
} | ||
} |
This file contains 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 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 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
DO NOT TOUCH; GENERATED BY DRONE | ||
<span class="mdl-layout-title">Lint Report: 3 errors and 73 warnings</span> | ||
<span class="mdl-layout-title">Lint Report: 3 errors and 70 warnings</span> |