Loading src/com/android/bluetooth/opp/BluetoothOppUtility.java +21 −1 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ public class BluetoothOppUtility { } if (isRecognizedFileType(context, path, mimetype)) { Intent activityIntent = new Intent(Intent.ACTION_VIEW); CustomIntent activityIntent = new CustomIntent(Intent.ACTION_VIEW); activityIntent.setDataAndTypeAndNormalize(path, mimetype); activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Loading Loading @@ -365,4 +365,24 @@ public class BluetoothOppUtility { } } } // Custom class to remove special characters from Intent.toString() static class CustomIntent extends Intent { public CustomIntent(String actionView) { super(actionView); } @Override public String toString() { if (V) Log.v(TAG, " Intent Info :" + super.toString()); if(super.toString().length() != super.toString().getBytes().length) { if (V) Log.v(TAG, "Removed special characters from path"); // Replace all special characters while returning string. return super.toString().replaceAll("[^\\x00-\\x7F]", ""); } else { return super.toString(); } } } } Loading
src/com/android/bluetooth/opp/BluetoothOppUtility.java +21 −1 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ public class BluetoothOppUtility { } if (isRecognizedFileType(context, path, mimetype)) { Intent activityIntent = new Intent(Intent.ACTION_VIEW); CustomIntent activityIntent = new CustomIntent(Intent.ACTION_VIEW); activityIntent.setDataAndTypeAndNormalize(path, mimetype); activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Loading Loading @@ -365,4 +365,24 @@ public class BluetoothOppUtility { } } } // Custom class to remove special characters from Intent.toString() static class CustomIntent extends Intent { public CustomIntent(String actionView) { super(actionView); } @Override public String toString() { if (V) Log.v(TAG, " Intent Info :" + super.toString()); if(super.toString().length() != super.toString().getBytes().length) { if (V) Log.v(TAG, "Removed special characters from path"); // Replace all special characters while returning string. return super.toString().replaceAll("[^\\x00-\\x7F]", ""); } else { return super.toString(); } } } }