Prevent ArrayIndexOutOfBoundsException for some invalid sysui_nav_bar values
A user can change sysui_nav_bar via adb. If value of sysui_nav_bar doesn't contain two semicolons, split String array is accessed out of bounds throwing an exception, sending SystemUI in an exception loop. Test: manual Test: adb exec-out settings put secure sysui_nav_bar "home;back" Change-Id: Ia9d74be36d287085650393476029489c9a359a0f
This commit is contained in:
committed by
Zoran Jovanovic
parent
a20239bf71
commit
c71ab6049f
@@ -219,6 +219,11 @@ public class NavigationBarInflaterView extends FrameLayout
|
||||
newLayout = getDefaultLayout();
|
||||
}
|
||||
String[] sets = newLayout.split(GRAVITY_SEPARATOR, 3);
|
||||
if (sets.length != 3) {
|
||||
Log.d(TAG, "Invalid layout.");
|
||||
newLayout = getDefaultLayout();
|
||||
sets = newLayout.split(GRAVITY_SEPARATOR, 3);
|
||||
}
|
||||
String[] start = sets[0].split(BUTTON_SEPARATOR);
|
||||
String[] center = sets[1].split(BUTTON_SEPARATOR);
|
||||
String[] end = sets[2].split(BUTTON_SEPARATOR);
|
||||
|
||||
Reference in New Issue
Block a user