From 4e3379cb9a0cc200710a7a87fe4d1e589738365c Mon Sep 17 00:00:00 2001 From: Roman Birg Date: Tue, 17 May 2016 11:12:41 -0700 Subject: Bluetooth: handle opening incoming APK files Ticket: FEIJ-493 Change-Id: I991146482ae69acf02ada93aa6c71441e67927d7 Signed-off-by: Roman Birg --- src/com/android/bluetooth/opp/BluetoothOppUtility.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/android/bluetooth/opp/BluetoothOppUtility.java b/src/com/android/bluetooth/opp/BluetoothOppUtility.java index f3774a034..081d15b52 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppUtility.java +++ b/src/com/android/bluetooth/opp/BluetoothOppUtility.java @@ -203,6 +203,14 @@ public class BluetoothOppUtility { return; } + CustomIntent activityIntent = new CustomIntent(Intent.ACTION_VIEW); + if ("application/vnd.android.package-archive".equals(mimetype)) { + // PackageInstaller doesn't like content URIs, so open file + activityIntent.setDataAndType(Uri.fromFile(f), mimetype); + context.startActivity(activityIntent); + return; + } + Uri path = FileProvider.getUriForFile(context, "com.google.android.bluetooth.fileprovider", f); // If there is no scheme, then it must be a file @@ -211,7 +219,6 @@ public class BluetoothOppUtility { } if (isRecognizedFileType(context, path, mimetype)) { - CustomIntent activityIntent = new CustomIntent(Intent.ACTION_VIEW); activityIntent.setDataAndTypeAndNormalize(path, mimetype); List resInfoList = context.getPackageManager() -- cgit v1.2.3