Skip to content
Permalink
Browse files

Merge remote-tracking branch 'upstream/9.0' into 9.0

  • Loading branch information...
lindwurm committed Jun 8, 2019
2 parents 02cf200 + 6a8d4ec commit ec092746649b5e86efb0610833bb5161b60ca3ff
Showing with 340 additions and 3 deletions.
  1. +5 −0 core/java/android/app/IActivityManager.aidl
  2. +11 −0 core/java/android/provider/Settings.java
  3. +3 −0 core/java/android/view/IWindowManager.aidl
  4. +10 −0 core/java/com/android/internal/policy/PhoneWindow.java
  5. +103 −0 core/java/com/android/internal/util/crdroid/cutout/CutoutFullscreenController.java
  6. +1 −1 core/res/res/values-cs-rCZ/cr_strings.xml
  7. +9 −0 packages/SystemUI/res/drawable/ic_qs_onehandtile.xml
  8. +2 −0 packages/SystemUI/res/values-be-rBY/cr_strings.xml
  9. +2 −0 packages/SystemUI/res/values-bg-rBG/cr_strings.xml
  10. +2 −0 packages/SystemUI/res/values-cs-rCZ/cr_strings.xml
  11. +2 −0 packages/SystemUI/res/values-de-rDE/cr_strings.xml
  12. +2 −0 packages/SystemUI/res/values-el-rGR/cr_strings.xml
  13. +2 −0 packages/SystemUI/res/values-es-rES/cr_strings.xml
  14. +2 −0 packages/SystemUI/res/values-fr-rFR/cr_strings.xml
  15. +2 −0 packages/SystemUI/res/values-hu-rHU/cr_strings.xml
  16. +2 −0 packages/SystemUI/res/values-in-rID/cr_strings.xml
  17. +2 −0 packages/SystemUI/res/values-it-rIT/cr_strings.xml
  18. +2 −0 packages/SystemUI/res/values-ja-rJP/cr_strings.xml
  19. +2 −0 packages/SystemUI/res/values-ko-rKR/cr_strings.xml
  20. +2 −0 packages/SystemUI/res/values-nl-rNL/cr_strings.xml
  21. +2 −0 packages/SystemUI/res/values-pl-rPL/cr_strings.xml
  22. +2 −0 packages/SystemUI/res/values-pt-rBR/cr_strings.xml
  23. +2 −0 packages/SystemUI/res/values-pt-rPT/cr_strings.xml
  24. +2 −0 packages/SystemUI/res/values-ro-rRO/cr_strings.xml
  25. +2 −0 packages/SystemUI/res/values-ru-rRU/cr_strings.xml
  26. +2 −0 packages/SystemUI/res/values-sk-rSK/cr_strings.xml
  27. +2 −0 packages/SystemUI/res/values-tr-rTR/cr_strings.xml
  28. +2 −0 packages/SystemUI/res/values-uk-rUA/cr_strings.xml
  29. +2 −0 packages/SystemUI/res/values-vi-rVN/cr_strings.xml
  30. +2 −0 packages/SystemUI/res/values-zh-rCN/cr_strings.xml
  31. +2 −0 packages/SystemUI/res/values-zh-rTW/cr_strings.xml
  32. +1 −1 packages/SystemUI/res/values/config.xml
  33. +3 −0 packages/SystemUI/res/values/cr_strings.xml
  34. +3 −0 packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSFactoryImpl.java
  35. +119 −0 packages/SystemUI/src/com/android/systemui/qs/tiles/OneHandTile.java
  36. +15 −0 services/core/java/com/android/server/am/ActivityManagerService.java
  37. +0 −1 services/core/java/com/android/server/audio/AudioService.java
  38. +9 −0 services/core/java/com/android/server/wm/WindowManagerService.java
@@ -714,4 +714,9 @@ interface IActivityManager {

/** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
void alwaysShowUnsupportedCompileSdkWarning(in ComponentName activity);

/**
* Force full screen for devices with cutout
*/
boolean shouldForceCutoutFullscreen(in String packageName);
}
@@ -4947,6 +4947,15 @@ public boolean validate(@Nullable String value) {
*/
public static final String RECENTS_OMNI_SWITCH_ENABLED = "recents_omni_switch";

/**
* Force full screen for devices with cutout
* @hide
*/
public static final String FORCE_FULLSCREEN_CUTOUT_APPS = "force_full_screen_cutout_apps";

/** @hide */
private static final Validator FORCE_FULLSCREEN_CUTOUT_APPS_VALIDATOR = ANY_STRING_VALIDATOR;

/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
@@ -5122,6 +5131,7 @@ public boolean validate(@Nullable String value) {
PRIVATE_SETTINGS.add(EGG_MODE);
PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE);
PRIVATE_SETTINGS.add(RECENTS_OMNI_SWITCH_ENABLED);
PRIVATE_SETTINGS.add(FORCE_FULLSCREEN_CUTOUT_APPS);
}

/**
@@ -5216,6 +5226,7 @@ public boolean validate(@Nullable String value) {
VALIDATORS.put(STATUS_BAR_CLOCK_SECONDS, STATUS_BAR_CLOCK_SECONDS_VALIDATOR);
VALIDATORS.put(STATUS_BAR_CLOCK_DATE_DISPLAY, STATUS_BAR_CLOCK_DATE_DISPLAY_VALIDATOR);
VALIDATORS.put(STATUS_BAR_CLOCK_DATE_STYLE, STATUS_BAR_CLOCK_DATE_STYLE_VALIDATOR);
VALIDATORS.put(FORCE_FULLSCREEN_CUTOUT_APPS, FORCE_FULLSCREEN_CUTOUT_APPS_VALIDATOR);
}

/**
@@ -453,6 +453,9 @@ interface IWindowManager
// This requires the ONE_HANDED_MODE permission.
boolean isOneHandedModeAvailable();

// This requires the ONE_HANDED_MODE permission.
boolean isOnehandTurnedON();

// This requires the ONE_HANDED_MODE permission.
float getOneHandedModeShrinkingScale();

@@ -2474,6 +2474,16 @@ protected ViewGroup generateLayout(DecorView decor) {
params.layoutInDisplayCutoutMode = mode;
}

if (ActivityManager.isSystemReady()) {
try {
String packageName = context.getBasePackageName();
if (ActivityManager.getService().shouldForceCutoutFullscreen(packageName)){
params.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
} catch (RemoteException e) {
}
}

if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion
>= android.os.Build.VERSION_CODES.HONEYCOMB) {
if (a.getBoolean(
@@ -0,0 +1,103 @@
/**
* Copyright (C) 2018 The LineageOS project
* Copyright (C) 2019 The PixelExperience project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.internal.util.crdroid.cutout;

import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.Looper;
import android.os.UserHandle;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import android.provider.Settings;

public class CutoutFullscreenController {
private Set<String> mApps = new HashSet<>();
private Context mContext;

public CutoutFullscreenController(Context context) {
mContext = context;

SettingsObserver observer = new SettingsObserver(
new Handler(Looper.getMainLooper()));
observer.observe();
}

public boolean shouldForceCutoutFullscreen(String packageName) {
return mApps.contains(packageName);
}

public Set<String> getApps() {
return mApps;
}

public void addApp(String packageName) {
mApps.add(packageName);
Settings.System.putString(mContext.getContentResolver(),
Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS, String.join(",", mApps));
}

public void removeApp(String packageName) {
mApps.remove(packageName);
Settings.System.putString(mContext.getContentResolver(),
Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS, String.join(",", mApps));
}

public void setApps(Set<String> apps) {
mApps = apps;
}

class SettingsObserver extends ContentObserver {
SettingsObserver(Handler handler) {
super(handler);
}

void observe() {
ContentResolver resolver = mContext.getContentResolver();

resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS), false, this,
UserHandle.USER_ALL);

update();
}

@Override
public void onChange(boolean selfChange) {
update();
}

public void update() {
ContentResolver resolver = mContext.getContentResolver();

String apps = Settings.System.getStringForUser(resolver,
Settings.System.FORCE_FULLSCREEN_CUTOUT_APPS,
UserHandle.USER_CURRENT);
if (apps != null) {
setApps(new HashSet<>(Arrays.asList(apps.split(","))));
} else {
setApps(new HashSet<>());
}
}
}
}
@@ -47,5 +47,5 @@
<!-- [CHAR LIMIT=NONE] Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_accessFontManager">Umožňuje aplikaci přístup ke správci písem.</string>
<!-- Informative text shown when the device is in One handed mode. It also explains how to exit the mode. -->
<string name="onehand_guide" xliff:restype="x-GENERIC/FULLSCREEN/TEXT">Kliknutím na prázdné místo ukončíte režim jedné ruky</string>
<string name="onehand_guide" xliff:restype="x-GENERIC/FULLSCREEN/TEXT">Klepnutím na prázdné místo ukončíte režim Ovládání jednou rukou</string>
</resources>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z" />

</vector>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Сямнаццаць</string>
<string name="text_clock_units_string_h_eighteen">Васямнаццаць</string>
<string name="text_clock_units_string_h_nineteen">Дзевятнаццаць</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Sedmnáct</string>
<string name="text_clock_units_string_h_eighteen">Osmnáct</string>
<string name="text_clock_units_string_h_nineteen">Devatenáct</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">Ovládání jednou rukou</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Diecisiete</string>
<string name="text_clock_units_string_h_eighteen">Dieciocho</string>
<string name="text_clock_units_string_h_nineteen">Diecinueve</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Dix-sept</string>
<string name="text_clock_units_string_h_eighteen">Dix-huit</string>
<string name="text_clock_units_string_h_nineteen">Dix-neuf</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Tizenhét</string>
<string name="text_clock_units_string_h_eighteen">Tizennyolc</string>
<string name="text_clock_units_string_h_nineteen">Tizenkilenc</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Diciassette</string>
<string name="text_clock_units_string_h_eighteen">Diciotto</string>
<string name="text_clock_units_string_h_nineteen">Diciannove</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">17</string>
<string name="text_clock_units_string_h_eighteen">18</string>
<string name="text_clock_units_string_h_nineteen">19</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Dezessete</string>
<string name="text_clock_units_string_h_eighteen">Dezoito</string>
<string name="text_clock_units_string_h_nineteen">Dezenove</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Șaptesprezece</string>
<string name="text_clock_units_string_h_eighteen">Optsprezece</string>
<string name="text_clock_units_string_h_nineteen">Nouăsprezece</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">Modul \"o singură mână\"</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Семнадцать</string>
<string name="text_clock_units_string_h_eighteen">Восемнадцать</string>
<string name="text_clock_units_string_h_nineteen">Девятнадцать</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">Управление одной рукой</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">On yedi</string>
<string name="text_clock_units_string_h_eighteen">On sekiz</string>
<string name="text_clock_units_string_h_nineteen">On dokuz</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Сімнадцять</string>
<string name="text_clock_units_string_h_eighteen">Вісімнадцять</string>
<string name="text_clock_units_string_h_nineteen">Дев\'ятнадцять</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Mười bảy</string>
<string name="text_clock_units_string_h_eighteen">Mười tám</string>
<string name="text_clock_units_string_h_nineteen">Mười chín</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -186,4 +186,6 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>
<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -123,7 +123,7 @@

<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
<string name="quick_settings_tiles_stock" translatable="false">
wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,work,cast,night,adb_network,ambient_display,always_on_display,hw_keys,caffeine,heads_up,screenshot,screenrecord,livedisplay,reading_mode,sync,usb_tether,volume_panel,profiles,cpuinfo,expanded_desktop,pie,compass,smartpixels,music,onthego,soundsearch,sound,lte,locale
wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,work,cast,night,adb_network,ambient_display,always_on_display,hw_keys,caffeine,heads_up,screenshot,screenrecord,livedisplay,reading_mode,sync,usb_tether,volume_panel,profiles,cpuinfo,expanded_desktop,pie,compass,smartpixels,music,onthego,onehand,soundsearch,sound,lte,locale
</string>

<!-- The tiles to display in QuickSettings -->
@@ -214,4 +214,7 @@
<string name="text_clock_units_string_h_seventeen">Seventeen</string>
<string name="text_clock_units_string_h_eighteen">Eighteen</string>
<string name="text_clock_units_string_h_nineteen">Nineteen</string>

<!-- OneHand mode QS tile -->
<string name="qs_onehand_label">One Handed mode</string>
</resources>
@@ -52,6 +52,7 @@
import com.android.systemui.qs.tiles.MusicTile;
import com.android.systemui.qs.tiles.NightDisplayTile;
import com.android.systemui.qs.tiles.OnTheGoTile;
import com.android.systemui.qs.tiles.OneHandTile;
import com.android.systemui.qs.tiles.PieTile;
import com.android.systemui.qs.tiles.ProfilesTile;
import com.android.systemui.qs.tiles.ReadingModeTile;
@@ -175,6 +176,8 @@ private QSTileImpl createTileInternal(String tileSpec) {
return new LteTile(mHost);
case "locale":
return new LocaleTile(mHost);
case "onehand":
return new OneHandTile(mHost);
}

// Intent tiles.

0 comments on commit ec09274

Please sign in to comment.
You can’t perform that action at this time.