Fine-tune the widget of "Allow rich content in Accessibility Settings" for security.

1. Remove tag checker in HtmlTextPreference.
2. Set the max height for AnimatedImagePreference.

Bug: 149516547
Test: manaul test
Change-Id: I98f49d055db9427d91a3f1ca816e94a11d29cd3d
Merged-In: I98f49d055db9427d91a3f1ca816e94a11d29cd3d
(cherry picked from commit 10bc375176)
This commit is contained in:
Peter_Liang
2020-02-18 13:27:05 +08:00
committed by PETER LIANG
parent 490eba353b
commit ab05476fc1
5 changed files with 81 additions and 75 deletions

View File

@@ -21,9 +21,11 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.accessibility.AccessibilityManager;
import androidx.annotation.IntDef;
@@ -350,4 +352,32 @@ final class AccessibilityUtil {
"Unsupported userShortcutType " + shortcutType);
}
}
/**
* Gets the width of the screen.
*
* @param context the current context.
* @return the width of the screen in terms of pixels.
*/
public static int getScreenWidthPixels(Context context) {
final Resources resources = context.getResources();
final int screenWidthDp = resources.getConfiguration().screenWidthDp;
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, screenWidthDp,
resources.getDisplayMetrics()));
}
/**
* Gets the height of the screen.
*
* @param context the current context.
* @return the height of the screen in terms of pixels.
*/
public static int getScreenHeightPixels(Context context) {
final Resources resources = context.getResources();
final int screenHeightDp = resources.getConfiguration().screenHeightDp;
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, screenHeightDp,
resources.getDisplayMetrics()));
}
}