Commit b6cbd3e3 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android WebAPK] Remove VIBRATE permission from WebAPK manifest

This CL removes the VIBRATE permission from the WebAPK manifest.
The permission was needed for delegating notifications to the WebAPK in
Jellybean. See crbug.com/773663 The permission is no longer needed
because Chrome no longer supports Jellybean.

This CL also:
- Increments the minSdkVersion to KitKat
- Deletes WebAPK/Webapp Jellybean-specific code

BUG=923518

Change-Id: I167867b2ad32e94dd894dea7f2b61279aacdd3a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1818598
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699022}
parent c84e5df5
...@@ -370,20 +370,10 @@ public class WebApkUma { ...@@ -370,20 +370,10 @@ public class WebApkUma {
* @return The available space that can be used to install WebAPK. Negative value means there is * @return The available space that can be used to install WebAPK. Negative value means there is
* less free space available than the system's minimum by the given amount. * less free space available than the system's minimum by the given amount.
*/ */
@SuppressWarnings("deprecation")
public static long getAvailableSpaceAboveLowSpaceLimit() { public static long getAvailableSpaceAboveLowSpaceLimit() {
long partitionAvailableBytes;
long partitionTotalBytes;
StatFs partitionStats = new StatFs(Environment.getDataDirectory().getAbsolutePath()); StatFs partitionStats = new StatFs(Environment.getDataDirectory().getAbsolutePath());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { long partitionAvailableBytes = partitionStats.getAvailableBytes();
partitionAvailableBytes = partitionStats.getAvailableBytes(); long partitionTotalBytes = partitionStats.getTotalBytes();
partitionTotalBytes = partitionStats.getTotalBytes();
} else {
// these APIs were deprecated in API level 18.
long blockSize = partitionStats.getBlockSize();
partitionAvailableBytes = blockSize * (long) partitionStats.getAvailableBlocks();
partitionTotalBytes = blockSize * (long) partitionStats.getBlockCount();
}
long minimumFreeBytes = getLowSpaceLimitBytes(partitionTotalBytes); long minimumFreeBytes = getLowSpaceLimitBytes(partitionTotalBytes);
long webApkExtraSpaceBytes = 0; long webApkExtraSpaceBytes = 0;
......
...@@ -408,9 +408,6 @@ public class WebappActivity extends SingleTabActivity { ...@@ -408,9 +408,6 @@ public class WebappActivity extends SingleTabActivity {
* If immersive mode is not supported, this method no-ops. * If immersive mode is not supported, this method no-ops.
*/ */
private void enterImmersiveMode() { private void enterImmersiveMode() {
// Immersive mode is only supported in API 19+.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
if (mSetImmersiveRunnable == null) { if (mSetImmersiveRunnable == null) {
final View decor = getWindow().getDecorView(); final View decor = getWindow().getDecorView();
......
...@@ -20,12 +20,10 @@ ...@@ -20,12 +20,10 @@
package="{{{manifest_package}}}" package="{{{manifest_package}}}"
android:versionCode="{{{version_code}}}" android:versionCode="{{{version_code}}}"
android:versionName="{{{version_name}}}" > android:versionName="{{{version_name}}}" >
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
{{{raw_manifest_tags}}} {{{raw_manifest_tags}}}
<uses-sdk <uses-sdk
android:minSdkVersion="16" android:minSdkVersion="19"
android:targetSdkVersion="28" /> android:targetSdkVersion="28" />
<application <application
......
...@@ -75,7 +75,7 @@ template("webapk_java") { ...@@ -75,7 +75,7 @@ template("webapk_java") {
"//chrome/android/webapk/libs/common:common_java", "//chrome/android/webapk/libs/common:common_java",
"//chrome/android/webapk/libs/common:splash_java", "//chrome/android/webapk/libs/common:splash_java",
] ]
min_sdk_version = 16 min_sdk_version = 19
} }
} }
...@@ -92,7 +92,7 @@ template("webapk_with_service_java") { ...@@ -92,7 +92,7 @@ template("webapk_with_service_java") {
"src/org/chromium/webapk/shell_apk/WebApkServiceImplWrapper.java", "src/org/chromium/webapk/shell_apk/WebApkServiceImplWrapper.java",
] ]
deps += [ ":compiled_in_runtime_library_java" ] deps += [ ":compiled_in_runtime_library_java" ]
min_sdk_version = 16 min_sdk_version = 19
} }
} }
...@@ -178,7 +178,7 @@ template("webapk_tmpl") { ...@@ -178,7 +178,7 @@ template("webapk_tmpl") {
android_manifest = _manifest_output android_manifest = _manifest_output
android_manifest_dep = ":$_manifest_target_name" android_manifest_dep = ":$_manifest_target_name"
min_sdk_version = 16 min_sdk_version = 19
target_sdk_version = 28 target_sdk_version = 28
never_incremental = true never_incremental = true
enable_multidex = false enable_multidex = false
......
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
# //chrome/android/webapk/shell_apk:webapk is changed. This includes # //chrome/android/webapk/shell_apk:webapk is changed. This includes
# Java files, Android resource files and AndroidManifest.xml. Does not affect # Java files, Android resource files and AndroidManifest.xml. Does not affect
# Chrome.apk # Chrome.apk
current_shell_apk_version = 106 current_shell_apk_version = 107
...@@ -201,8 +201,8 @@ public class ChooseHostBrowserDialog { ...@@ -201,8 +201,8 @@ public class ChooseHostBrowserDialog {
Resources res = mContext.getResources(); Resources res = mContext.getResources();
ImageView icon = (ImageView) convertView.findViewById(R.id.browser_icon); ImageView icon = (ImageView) convertView.findViewById(R.id.browser_icon);
TextView name = (TextView) convertView.findViewById(R.id.browser_name); TextView name = (TextView) convertView.findViewById(R.id.browser_name);
WebApkUtils.setPaddingInPixel( name.setPaddingRelative(
name, res.getDimensionPixelSize(R.dimen.list_column_padding), 0, 0, 0); res.getDimensionPixelSize(R.dimen.list_column_padding), 0, 0, 0);
BrowserItem item = mBrowsers.get(position); BrowserItem item = mBrowsers.get(position);
name.setEnabled(item.supportsWebApks()); name.setEnabled(item.supportsWebApks());
......
...@@ -49,7 +49,7 @@ public class InstallHostBrowserDialog { ...@@ -49,7 +49,7 @@ public class InstallHostBrowserDialog {
TextView name = (TextView) view.findViewById(R.id.browser_name); TextView name = (TextView) view.findViewById(R.id.browser_name);
name.setText(hostBrowserApplicationName); name.setText(hostBrowserApplicationName);
WebApkUtils.setPaddingInPixel(name, name.setPaddingRelative(
context.getResources().getDimensionPixelSize(R.dimen.list_column_padding), 0, 0, 0); context.getResources().getDimensionPixelSize(R.dimen.list_column_padding), 0, 0, 0);
OnDismissListenerCanceler onDismissCanceler = new OnDismissListenerCanceler(); OnDismissListenerCanceler onDismissCanceler = new OnDismissListenerCanceler();
......
...@@ -147,19 +147,6 @@ public class WebApkUtils { ...@@ -147,19 +147,6 @@ public class WebApkUtils {
return -1; return -1;
} }
/**
* Android uses padding_left under API level 17 and uses padding_start after that.
* If we set the padding in resource file, android will create duplicated resource xml
* with the padding to be different.
*/
public static void setPaddingInPixel(View view, int start, int top, int end, int bottom) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setPaddingRelative(start, top, end, bottom);
} else {
view.setPadding(start, top, end, bottom);
}
}
/** /**
* Imitates Chrome's @style/AlertDialogContent. We set the style via Java instead of via * Imitates Chrome's @style/AlertDialogContent. We set the style via Java instead of via
* specifying the style in the XML to avoid having layout files in both layout-v17/ and in * specifying the style in the XML to avoid having layout files in both layout-v17/ and in
...@@ -173,11 +160,11 @@ public class WebApkUtils { ...@@ -173,11 +160,11 @@ public class WebApkUtils {
TypedValue.COMPLEX_UNIT_PX, res.getDimension(R.dimen.headline_size_medium)); TypedValue.COMPLEX_UNIT_PX, res.getDimension(R.dimen.headline_size_medium));
int dialogContentPadding = res.getDimensionPixelSize(R.dimen.dialog_content_padding); int dialogContentPadding = res.getDimensionPixelSize(R.dimen.dialog_content_padding);
int titleBottomPadding = res.getDimensionPixelSize(R.dimen.title_bottom_padding); int titleBottomPadding = res.getDimensionPixelSize(R.dimen.title_bottom_padding);
setPaddingInPixel(titleView, dialogContentPadding, dialogContentPadding, titleView.setPaddingRelative(dialogContentPadding, dialogContentPadding,
dialogContentPadding, titleBottomPadding); dialogContentPadding, titleBottomPadding);
int dialogContentTopPadding = res.getDimensionPixelSize(R.dimen.dialog_content_top_padding); int dialogContentTopPadding = res.getDimensionPixelSize(R.dimen.dialog_content_top_padding);
setPaddingInPixel(contentView, dialogContentPadding, dialogContentTopPadding, contentView.setPaddingRelative(dialogContentPadding, dialogContentTopPadding,
dialogContentPadding, dialogContentPadding); dialogContentPadding, dialogContentPadding);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment