aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-29 20:52:04 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-29 20:52:04 +0100
commite15df13f4c8766c073feddb87094913597c53b14 (patch)
tree95acabf34dae351106fccd555cc24adec8da2078 /src/main/java
parent7a0455f21eb12e56c05fce2705f23b0ca4b15cf8 (diff)
bypass check for unknown source settings for OERO
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index b53c56390..b7018b58c 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -1708,8 +1708,15 @@ public class ConversationActivity extends XmppActivity
boolean installFromUnknownSource = false;
int isUnknownAllowed = 0;
if (Build.VERSION.SDK_INT >= 26) {
- installFromUnknownSource = packageManager.canRequestPackageInstalls();
- } else if (Build.VERSION.SDK_INT >= 17) {
+ /*
+ * On Android 8 with applications targeting lower versions,
+ * it's impossible to check unknown sources enabled: using old APIs will always return true
+ * and using the new one will always return false,
+ * so in order to avoid a stuck dialog that can't be bypassed we will assume true.
+ */
+ installFromUnknownSource = this.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O
+ || packageManager.canRequestPackageInstalls();
+ } else if (Build.VERSION.SDK_INT >= 17 && Build.VERSION.SDK_INT < 26) {
try {
isUnknownAllowed = Settings.Global.getInt(this.getApplicationContext().getContentResolver(), Settings.Global.INSTALL_NON_MARKET_APPS);
} catch (Settings.SettingNotFoundException e) {
@@ -1726,7 +1733,7 @@ public class ConversationActivity extends XmppActivity
}
installFromUnknownSource = isUnknownAllowed == 1;
}
- Log.d(Config.LOGTAG, "Install from unknown sources for Android SDK " + Build.VERSION.SDK_INT + " allowd: " + installFromUnknownSource);
+ Log.d(Config.LOGTAG, "Install from unknown sources for Android SDK " + Build.VERSION.SDK_INT + " allowed: " + installFromUnknownSource);
if (!installFromUnknownSource) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);