Bug Fixes for: Browser Provider, Accessibility and Downloads
Specifically:
- Added alias name for provider
- Fixed max values for font in the settings' accessiblity menu
- Fixed reflection code wrt downloading a file
Change-Id: I80ffc9f188052588c3e884996d49ee4fa301ac7f
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 974052e..ccd5d77 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -64,7 +64,7 @@
android:required="false" />
<provider android:name="com.android.swe.browser.provider.BrowserProvider2"
- android:authorities="com.android.swe.browser"
+ android:authorities="com.android.swe.browser;swebrowser"
android:multiprocess="false"
android:exported="true"
android:readPermission="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
diff --git a/src/com/android/swe/browser/DownloadHandler.java b/src/com/android/swe/browser/DownloadHandler.java
index eac63cd..2710907 100644
--- a/src/com/android/swe/browser/DownloadHandler.java
+++ b/src/com/android/swe/browser/DownloadHandler.java
@@ -115,20 +115,18 @@
}
private static boolean isAudioFileType(int fileType){
- Object[] params = { new Integer(fileType)};
- Class[] type = new Class[] {Integer.class};
+ Object[] params = {Integer.valueOf(fileType)};
+ Class[] type = new Class[] {int.class};
Boolean result = (Boolean) ReflectHelper.invokeStaticMethod("android.media.MediaFile",
- "isAudioFileType",
- type, params);
+ "isAudioFileType", type, params);
return result;
}
private static boolean isVideoFileType(int fileType){
- Object[] params = { new Integer(fileType)};
- Class[] type = new Class[] {Integer.class};
+ Object[] params = {Integer.valueOf(fileType)};
+ Class[] type = new Class[] {int.class};
Boolean result = (Boolean) ReflectHelper.invokeStaticMethod("android.media.MediaFile",
- "isVideoFileType",
- type, params);
+ "isVideoFileType", type, params);
return result;
}
@@ -160,13 +158,10 @@
// such as ogg audio file with mimetype "application/ogg". So we also check
// file type by MediaFile.isAudioFileType() and MediaFile.isVideoFileType().
// For those file types other than audio or video, download it immediately.
-
- //int fileType = MediaFile.getFileTypeForMimeType(mimetype);
- Object[] params = { new Integer(mimetype)};
- Class[] type = new Class[] {Integer.class};
+ Object[] params = {mimetype};
+ Class[] type = new Class[] {String.class};
Integer result = (Integer) ReflectHelper.invokeStaticMethod("android.media.MediaFile",
- "getFileTypeForMimeType",
- type, params);
+ "getFileTypeForMimeType", type, params);
int fileType = result.intValue();
if ("http".equalsIgnoreCase(scheme) &&
(mimetype.startsWith("audio/") ||
@@ -193,8 +188,7 @@
activity.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.w(LOGTAG, "When http stream play, activity not found for "
- + mimetype + " over " + Uri.parse(url).getScheme(),
- ex);
+ + mimetype + " over " + Uri.parse(url).getScheme(), ex);
}
}
}).show();
diff --git a/src/com/android/swe/browser/platformsupport/SeekBarPreference.java b/src/com/android/swe/browser/platformsupport/SeekBarPreference.java
index 5af5312..6b40ad0 100644
--- a/src/com/android/swe/browser/platformsupport/SeekBarPreference.java
+++ b/src/com/android/swe/browser/platformsupport/SeekBarPreference.java
@@ -21,21 +21,12 @@
public SeekBarPreference(
Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
-
- int[] attributes = new int[] { android.R.attr.indeterminateDrawable};
- TypedArray a = context.obtainStyledAttributes(
- android.R.style.Widget_ProgressBar, attributes);
- //SWE_TODO: Modify setMax to attain max from XML
- setMax(100);
- a.recycle();
+ //SWE: Unable to attain the internal resources via reflection, instead
+ //attaining the max values from xml directly
+ int max = attrs.getAttributeIntValue(
+ "http://schemas.android.com/apk/res/android", "max", mMax);
+ setMax(max);
setLayoutResource(com.android.swe.browser.R.layout.preference_widget_seekbar);
- /*SWE_TODO : Refactor to use Reflection & replace corresponding above
- TypedArray a = context.obtainStyledAttributes(attrs,
- com.android.internal.R.styleable.ProgressBar, defStyle, 0);
- setMax(a.getInt(com.android.internal.R.styleable.ProgressBar_max, mMax));
- a.recycle();
- setLayoutResource(com.android.internal.R.layout.preference_widget_seekbar);
- */
}
public SeekBarPreference(Context context, AttributeSet attrs) {