From dcdfacf80b5a126af36c1073fd0ae8bdf4ec9e92 Mon Sep 17 00:00:00 2001 From: Jon West Date: Sat, 31 Jul 2021 17:28:52 -0400 Subject: [PATCH 01/13] Allow for use with multiple ROMs Initially Bliss & Lineage --- .gitignore | 1 + apply-patches.sh | 27 - autopatch.sh | 163 ++ ...bris-don-t-fail-because-of-fsetxattr.patch | 0 ..._extra-lib-folders-to-default-librar.patch | 0 ...box-do-not-fail-on-VNDK-ABI-mismatch.patch | 0 .../0001-stable-Add-xdg-shell.patch | 0 ...libcameraservice-Use-listByInterface.patch | 0 ...lparser-Add-host-dirs-to-search-path.patch | 0 ...ec-Use-vendor_extra-seccomp-minijail.patch | 0 ...Add-host-media_profiles-search-paths.patch | 0 .../0005-drm-Fix-drm-on-older-vendors.patch | 0 ...06-codec2-Fix-media-on-older-vendors.patch | 0 ...007-SW-encode-Fix-output-buffer-size.patch | 0 ...-Add-vendor_extra-to-ld-search-paths.patch | 0 ...-and-height-supported-by-H.263-decod.patch | 0 ...ractor-Add-more-sample-rates-support.patch | 0 ...YV12-color-format-for-video-decoding.patch | 0 ...ow-screenrecord-usage-on-Android-x86.patch | 0 ...able-dithering-for-RGB565-conversion.patch | 0 .../0013-nuplayer-skip-bad-SAR-values.patch | 0 ...support-for-loading-a-custom-OMXPlug.patch | 0 ...ght-allow-multiple-custom-OMXPlugins.patch | 0 ...ht-Extended-media-support-via-FFMPEG.patch | 0 ...nd-system-libraries-for-swcodec-APEX.patch | 0 ...FFMPEG-audio-mpeg-L2-codec-correctly.patch | 0 .../0001-anbox-disable-SELinux-parts.patch | 0 .../0002-anbox-disable-suspend-control.patch | 0 ...ralize-sound-pool-audio-sample-loadi.patch | 0 ...tart-thread-pool-for-host-hwbinder-w.patch | 0 ...-fwb-Don-t-check-vintf-compatibility.patch | 0 ...e-system-from-entering-a-sleep-state.patch | 0 .../0007-core-Add-support-for-MicroG.patch | 0 ...add-a-permission-group-for-signature.patch | 0 .../base/0009-Zygote-Disable-seccomp.patch | 0 ...1-anbox-installd-run-without-SELinux.patch | 0 ...ble-SELinux-checks-in-ServiceManager.patch | 0 ...-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch | 0 ...til-it-works-with-our-fake-evdev-eve.patch | 0 ...inger-Provide-layer-names-and-stuffs.patch | 0 ...-EventHub-Add-wayland-inputs-support.patch | 0 ...dd-absolute-event-support-for-cursor.patch | 0 ...rEngine-support-non-RGBA_8888-format.patch | 0 ...pixel-format-by-EGL_NATIVE_VISUAL_ID.patch | 0 ...ndor_extra-lib-hw-to-HAL-search-path.patch | 0 ...hardware-Don-t-check-for-ro.hardware.patch | 0 ...ACKAGE_SIGNATURE-to-platform-permiss.patch | 0 ...-double_tap_sleep_gesture-by-default.patch | 0 ...-inside-LXC-container-without-SELinu.patch | 0 ...y-mount_all-to-skip-mounts-and-trigg.patch | 0 ...just-backup-service-name-to-avoid-co.patch | 0 ...04-temp-anbox-temporary-disable-adbd.patch | 0 ..._extra-path-as-a-clone-of-vendor-ent.patch | 0 ...6-libsync-Add-sw_sync-symbols-to-map.patch | 0 .../core/0007-sdcard-Bring-back-fuse.patch | 0 ...0008-sdcard-Add-full-mount-directory.patch | 0 ...spend-Set-mUseSuspendCounter-to-true.patch | 0 .../0001-halium-disable-SELinux-parts.patch | 0 .../netd/0001-netd-Fix-networking.patch | 0 .../nfc/0001-nfc-Add-host-search-paths.patch | 0 ...0001-keystore-Supress-SELinux-errors.patch | 0 ...ow-host_hwbinder-to-be-used-for-HALs.patch | 0 .../vold/0001-vold-Fix-fuse-sdcard.patch | 0 ...op-selinux-checks-on-prepare_subdirs.patch | 0 ...003-Revert-Remove-waitpid-on-UnMount.patch | 0 ...nd-system-libraries-for-swcodec-APEX.patch | 40 + .../0007-core-Add-support-for-MicroG.patch | 92 + ...add-a-permission-group-for-signature.patch | 56 + .../0001-stable-Add-xdg-shell.patch | 1900 +++++++++++++++++ ...libcameraservice-Use-listByInterface.patch | 51 + ...box-do-not-fail-on-VNDK-ABI-mismatch.patch | 29 + roms.lst | 3 + vendorsetup.sh | 51 + 73 files changed, 2386 insertions(+), 27 deletions(-) create mode 100644 .gitignore delete mode 100755 apply-patches.sh create mode 100755 autopatch.sh rename {bionic => base-patches/bionic}/0001-hybris-don-t-fail-because-of-fsetxattr.patch (100%) rename {bionic => base-patches/bionic}/0002-anbox-add-vendor_extra-lib-folders-to-default-librar.patch (100%) rename {build => base-patches/build}/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch (100%) rename {external => base-patches/external}/wayland-protocols/0001-stable-Add-xdg-shell.patch (100%) rename {frameworks => base-patches/frameworks}/av/0001-libcameraservice-Use-listByInterface.patch (100%) rename {frameworks => base-patches/frameworks}/av/0002-media-xmlparser-Add-host-dirs-to-search-path.patch (100%) rename {frameworks => base-patches/frameworks}/av/0003-mediacodec-Use-vendor_extra-seccomp-minijail.patch (100%) rename {frameworks => base-patches/frameworks}/av/0004-media-Add-host-media_profiles-search-paths.patch (100%) rename {frameworks => base-patches/frameworks}/av/0005-drm-Fix-drm-on-older-vendors.patch (100%) rename {frameworks => base-patches/frameworks}/av/0006-codec2-Fix-media-on-older-vendors.patch (100%) rename {frameworks => base-patches/frameworks}/av/0007-SW-encode-Fix-output-buffer-size.patch (100%) rename {frameworks => base-patches/frameworks}/av/0007-apex-Add-vendor_extra-to-ld-search-paths.patch (100%) rename {frameworks => base-patches/frameworks}/av/0008-Change-max-width-and-height-supported-by-H.263-decod.patch (100%) rename {frameworks => base-patches/frameworks}/av/0009-FLACExtractor-Add-more-sample-rates-support.patch (100%) rename {frameworks => base-patches/frameworks}/av/0010-Don-t-use-YV12-color-format-for-video-decoding.patch (100%) rename {frameworks => base-patches/frameworks}/av/0011-Allow-screenrecord-usage-on-Android-x86.patch (100%) rename {frameworks => base-patches/frameworks}/av/0012-media-enable-dithering-for-RGB565-conversion.patch (100%) rename {frameworks => base-patches/frameworks}/av/0013-nuplayer-skip-bad-SAR-values.patch (100%) rename {frameworks => base-patches/frameworks}/av/0014-stagefright-Add-support-for-loading-a-custom-OMXPlug.patch (100%) rename {frameworks => base-patches/frameworks}/av/0015-stagefright-allow-multiple-custom-OMXPlugins.patch (100%) rename {frameworks => base-patches/frameworks}/av/0016-libstagefright-Extended-media-support-via-FFMPEG.patch (100%) rename {frameworks => base-patches/frameworks}/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch (100%) rename {frameworks => base-patches/frameworks}/av/0018-Setup-FFMPEG-audio-mpeg-L2-codec-correctly.patch (100%) rename {frameworks => base-patches/frameworks}/base/0001-anbox-disable-SELinux-parts.patch (100%) rename {frameworks => base-patches/frameworks}/base/0002-anbox-disable-suspend-control.patch (100%) rename {frameworks => base-patches/frameworks}/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch (100%) rename {frameworks => base-patches/frameworks}/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch (100%) rename {frameworks => base-patches/frameworks}/base/0005-fwb-Don-t-check-vintf-compatibility.patch (100%) rename {frameworks => base-patches/frameworks}/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch (100%) rename {frameworks => base-patches/frameworks}/base/0007-core-Add-support-for-MicroG.patch (100%) rename {frameworks => base-patches/frameworks}/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch (100%) rename {frameworks => base-patches/frameworks}/base/0009-Zygote-Disable-seccomp.patch (100%) rename {frameworks => base-patches/frameworks}/native/0001-anbox-installd-run-without-SELinux.patch (100%) rename {frameworks => base-patches/frameworks}/native/0002-halium-disable-SELinux-checks-in-ServiceManager.patch (100%) rename {frameworks => base-patches/frameworks}/native/0003-halium-never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch (100%) rename {frameworks => base-patches/frameworks}/native/0004-Hack-EventHub-until-it-works-with-our-fake-evdev-eve.patch (100%) rename {frameworks => base-patches/frameworks}/native/0005-surfaceflinger-Provide-layer-names-and-stuffs.patch (100%) rename {frameworks => base-patches/frameworks}/native/0006-EventHub-Add-wayland-inputs-support.patch (100%) rename {frameworks => base-patches/frameworks}/native/0007-inputflinger-add-absolute-event-support-for-cursor.patch (100%) rename {frameworks => base-patches/frameworks}/native/0008-RenderEngine-support-non-RGBA_8888-format.patch (100%) rename {frameworks => base-patches/frameworks}/native/0009-libEGL-select-pixel-format-by-EGL_NATIVE_VISUAL_ID.patch (100%) rename {hardware => base-patches/hardware}/libhardware/0001-anbox-add-vendor_extra-lib-hw-to-HAL-search-path.patch (100%) rename {hardware => base-patches/hardware}/libhardware/0002-libhardware-Don-t-check-for-ro.hardware.patch (100%) rename {packages => base-patches/packages}/apps/PermissionController/0001-Utils-add-FAKE_PACKAGE_SIGNATURE-to-platform-permiss.patch (100%) rename {packages => base-patches/packages}/apps/Settings/0001-Settings-Disable-double_tap_sleep_gesture-by-default.patch (100%) rename {system => base-patches/system}/core/0001-anbox-init-start-inside-LXC-container-without-SELinu.patch (100%) rename {system => base-patches/system}/core/0002-anbox-init-modify-mount_all-to-skip-mounts-and-trigg.patch (100%) rename {system => base-patches/system}/core/0003-anbox-healthd-adjust-backup-service-name-to-avoid-co.patch (100%) rename {system => base-patches/system}/core/0004-temp-anbox-temporary-disable-adbd.patch (100%) rename {system => base-patches/system}/core/0005-anbox-add-vendor_extra-path-as-a-clone-of-vendor-ent.patch (100%) rename {system => base-patches/system}/core/0006-libsync-Add-sw_sync-symbols-to-map.patch (100%) rename {system => base-patches/system}/core/0007-sdcard-Bring-back-fuse.patch (100%) rename {system => base-patches/system}/core/0008-sdcard-Add-full-mount-directory.patch (100%) rename {system => base-patches/system}/hardware/interfaces/0001-suspend-Set-mUseSuspendCounter-to-true.patch (100%) rename {system => base-patches/system}/hwservicemanager/0001-halium-disable-SELinux-parts.patch (100%) rename {system => base-patches/system}/netd/0001-netd-Fix-networking.patch (100%) rename {system => base-patches/system}/nfc/0001-nfc-Add-host-search-paths.patch (100%) rename {system => base-patches/system}/security/0001-keystore-Supress-SELinux-errors.patch (100%) rename {system => base-patches/system}/tools/hidl/0001-anbox-Allow-host_hwbinder-to-be-used-for-HALs.patch (100%) rename {system => base-patches/system}/vold/0001-vold-Fix-fuse-sdcard.patch (100%) rename {system => base-patches/system}/vold/0002-vold-Drop-selinux-checks-on-prepare_subdirs.patch (100%) rename {system => base-patches/system}/vold/0003-Revert-Remove-waitpid-on-UnMount.patch (100%) create mode 100644 bliss/patches/frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch create mode 100644 bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch create mode 100644 bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch create mode 100644 lineage/patches/build/external/wayland-protocols/0001-stable-Add-xdg-shell.patch create mode 100644 lineage/patches/build/frameworks/av/0001-libcameraservice-Use-listByInterface.patch create mode 100644 lineage/patches/build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch create mode 100644 roms.lst create mode 100644 vendorsetup.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7b8c45a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +anbox-halium/ diff --git a/apply-patches.sh b/apply-patches.sh deleted file mode 100755 index 70d08d0..0000000 --- a/apply-patches.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -e - -MB=$1 - -USE_PATCH=0 -if [ "$MB" != "--mb" ]; then - USE_PATCH=1 -fi - -OLD_WD=`pwd` -cd anbox-patches - -if [ "$USE_PATCH" == "1" ]; then - for patch in `find . -name *.patch |sort`; do - cd $OLD_WD/$(dirname $patch) - patch -p1 < $OLD_WD/anbox-patches/$patch - done -else - MBS=$(find . -name *.patch -exec dirname {} \; |sort -u) - for mb in $MBS; do - cd $OLD_WD/$mb - git am --no-gpg-sign $OLD_WD/anbox-patches/$mb/*.patch - done -fi - diff --git a/autopatch.sh b/autopatch.sh new file mode 100755 index 0000000..db2b4a9 --- /dev/null +++ b/autopatch.sh @@ -0,0 +1,163 @@ +#!/bin/bash +# -*- coding: utf-8; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- + +# autopatch.sh: script to manage patches on top of repo +# Copyright (c) 2018, Intel Corporation. +# Author: sgnanase +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +top_dir=`pwd` +vendor_path="anbox" +utils_dir="$top_dir/vendor/$vendor_path" +patch_dir="$utils_dir/base-patches" +private_utils_dir="$top_dir/vendor/anbox/PRIVATE" +private_patch_dir="$private_utils_dir/patches/$TARGET_PRODUCT" + +#setup colors +red=`tput setaf 1` +green=`tput setaf 2` +yellow=`tput setaf 3` +blue=`tput setaf 4` +purple=`tput setaf 5` +teal=`tput setaf 6` +light=`tput setaf 7` +dark=`tput setaf 8` +ltred=`tput setaf 9` +ltgreen=`tput setaf 10` +ltyellow=`tput setaf 11` +ltblue=`tput setaf 12` +ltpurple=`tput setaf 13` +CL_CYN=`tput setaf 12` +CL_RST=`tput sgr0` +reset=`tput sgr0` +current_project="" +previous_project="" +conflict="" +conflict_list="" +goodpatch="" +project_revision="" + +tag_project() { + cd $top_dir/$1 + git tag -f autopatch/`basename $patch_dir` > /dev/null +} + +apply_patch() { + + pl=$1 + pd=$2 + + echo -e ${reset}""${reset} + echo -e ${teal}"Applying Patches"${reset} + echo -e ${reset}""${reset} + + for i in $pl + do + current_project=`dirname $i` + if [[ $current_project != $previous_project ]]; then + if [[ -n "$previous_project" ]]; then + tag_project $previous_project + fi + echo -e ${reset}""${reset} + echo -e ${ltblue}"Project $current_project"${reset} + echo -e ${reset}""${reset} + cd $top_dir + project_revision=`repo info $current_project | grep 'Current revision: ' | sed 's/Current revision: //'` + fi + previous_project=$current_project + + conflict_project=`echo $conflict_list | grep " $current_project "` + if [[ -n "$conflict_project" ]]; then + echo -e ${reset}""${reset} + echo -e ${ltgreen}" Skipping $i"${reset} + echo -e ${reset}""${reset} + fi + + cd $top_dir/$current_project + a=`grep "Date: " $pd/$i | sed -e "s/Date: //"` + b=`grep "Subject: " $pd/$i | sed -e "s/Subject: //" | sed -e "s/^\[PATCH[^]]*\] //"` + c=`git log --pretty="format:%aD, %s" $project_revision.. | grep -F "$a, $b"` + + if [[ "$c" == "" ]] ; then + git am -3 $pd/$i >& /dev/null + + if [[ $? == 0 ]]; then + echo -e ${reset}""${reset} + echo -e ${ltgreen}" Applying $i"${reset} + echo -e ${reset}""${reset} + + else + echo -e ${reset}""${reset} + echo -e ${ltred}" Conflicts $i"${reset} + echo -e ${reset}""${reset} + git am --abort >& /dev/null + + echo " Searching other vendors for patch resolutions..." + while IFS= read -r agvendor_name; do + echo " looking in $agvendor_name for that patch..." + if [[ -f "$utils_dir/$agvendor_name/patches/$i" ]]; then + echo " Found $utils_dir/$agvendor_name/patches/$i!!" + echo " trying..." + git am -3 $utils_dir/$agvendor_name/patches/$i >& /dev/null + if [[ $? == 0 ]]; then + echo " Applying $i $?" + goodpatch="y" + break + else + echo " Conflicts $i" + git am --abort >& /dev/null + conflict="y" + + fi + + fi + done < $top_dir/vendor/$vendor_path/roms.lst + if [[ "$goodpatch" != "y" ]]; then + echo " No resolution was found" + git am --abort >& /dev/null + echo " Setting $i as Conflicts" + conflict="y" + conflict_list="$current_project $conflict_list" + + fi + fi + else + echo -e ${reset}""${reset} + echo -e ${green}" Already applied $i"${reset} + echo -e ${reset}""${reset} + fi + done + + if [[ -n "$previous_project" ]]; then + tag_project $previous_project + fi +} + +#Apply common patches +cd $patch_dir +patch_list=`find * -iname "*.patch" | sort -u` + +apply_patch "$patch_list" "$patch_dir" + +echo "" +if [[ "$conflict" == "y" ]]; then + echo -e ${yellow} "==========================================================================="${reset} + echo -e ${yellow} " ALERT : Conflicts Observed while patch application !! "${reset} + echo -e ${yellow} "==========================================================================="${reset} + for i in $conflict_list ; do echo $i; done | sort -u + echo -e ${yellow} "==========================================================================="${reset} + echo -e ${yellow} "WARNING: Please resolve Conflict(s). You may need to re-run build..."${reset} + # return 1 +else + echo -e ${green} "==========================================================================="${reset} + echo -e ${green} " INFO : All patches applied fine !! "${reset} + echo -e ${green} "==========================================================================="${reset} +fi diff --git a/bionic/0001-hybris-don-t-fail-because-of-fsetxattr.patch b/base-patches/bionic/0001-hybris-don-t-fail-because-of-fsetxattr.patch similarity index 100% rename from bionic/0001-hybris-don-t-fail-because-of-fsetxattr.patch rename to base-patches/bionic/0001-hybris-don-t-fail-because-of-fsetxattr.patch diff --git a/bionic/0002-anbox-add-vendor_extra-lib-folders-to-default-librar.patch b/base-patches/bionic/0002-anbox-add-vendor_extra-lib-folders-to-default-librar.patch similarity index 100% rename from bionic/0002-anbox-add-vendor_extra-lib-folders-to-default-librar.patch rename to base-patches/bionic/0002-anbox-add-vendor_extra-lib-folders-to-default-librar.patch diff --git a/build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch b/base-patches/build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch similarity index 100% rename from build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch rename to base-patches/build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch diff --git a/external/wayland-protocols/0001-stable-Add-xdg-shell.patch b/base-patches/external/wayland-protocols/0001-stable-Add-xdg-shell.patch similarity index 100% rename from external/wayland-protocols/0001-stable-Add-xdg-shell.patch rename to base-patches/external/wayland-protocols/0001-stable-Add-xdg-shell.patch diff --git a/frameworks/av/0001-libcameraservice-Use-listByInterface.patch b/base-patches/frameworks/av/0001-libcameraservice-Use-listByInterface.patch similarity index 100% rename from frameworks/av/0001-libcameraservice-Use-listByInterface.patch rename to base-patches/frameworks/av/0001-libcameraservice-Use-listByInterface.patch diff --git a/frameworks/av/0002-media-xmlparser-Add-host-dirs-to-search-path.patch b/base-patches/frameworks/av/0002-media-xmlparser-Add-host-dirs-to-search-path.patch similarity index 100% rename from frameworks/av/0002-media-xmlparser-Add-host-dirs-to-search-path.patch rename to base-patches/frameworks/av/0002-media-xmlparser-Add-host-dirs-to-search-path.patch diff --git a/frameworks/av/0003-mediacodec-Use-vendor_extra-seccomp-minijail.patch b/base-patches/frameworks/av/0003-mediacodec-Use-vendor_extra-seccomp-minijail.patch similarity index 100% rename from frameworks/av/0003-mediacodec-Use-vendor_extra-seccomp-minijail.patch rename to base-patches/frameworks/av/0003-mediacodec-Use-vendor_extra-seccomp-minijail.patch diff --git a/frameworks/av/0004-media-Add-host-media_profiles-search-paths.patch b/base-patches/frameworks/av/0004-media-Add-host-media_profiles-search-paths.patch similarity index 100% rename from frameworks/av/0004-media-Add-host-media_profiles-search-paths.patch rename to base-patches/frameworks/av/0004-media-Add-host-media_profiles-search-paths.patch diff --git a/frameworks/av/0005-drm-Fix-drm-on-older-vendors.patch b/base-patches/frameworks/av/0005-drm-Fix-drm-on-older-vendors.patch similarity index 100% rename from frameworks/av/0005-drm-Fix-drm-on-older-vendors.patch rename to base-patches/frameworks/av/0005-drm-Fix-drm-on-older-vendors.patch diff --git a/frameworks/av/0006-codec2-Fix-media-on-older-vendors.patch b/base-patches/frameworks/av/0006-codec2-Fix-media-on-older-vendors.patch similarity index 100% rename from frameworks/av/0006-codec2-Fix-media-on-older-vendors.patch rename to base-patches/frameworks/av/0006-codec2-Fix-media-on-older-vendors.patch diff --git a/frameworks/av/0007-SW-encode-Fix-output-buffer-size.patch b/base-patches/frameworks/av/0007-SW-encode-Fix-output-buffer-size.patch similarity index 100% rename from frameworks/av/0007-SW-encode-Fix-output-buffer-size.patch rename to base-patches/frameworks/av/0007-SW-encode-Fix-output-buffer-size.patch diff --git a/frameworks/av/0007-apex-Add-vendor_extra-to-ld-search-paths.patch b/base-patches/frameworks/av/0007-apex-Add-vendor_extra-to-ld-search-paths.patch similarity index 100% rename from frameworks/av/0007-apex-Add-vendor_extra-to-ld-search-paths.patch rename to base-patches/frameworks/av/0007-apex-Add-vendor_extra-to-ld-search-paths.patch diff --git a/frameworks/av/0008-Change-max-width-and-height-supported-by-H.263-decod.patch b/base-patches/frameworks/av/0008-Change-max-width-and-height-supported-by-H.263-decod.patch similarity index 100% rename from frameworks/av/0008-Change-max-width-and-height-supported-by-H.263-decod.patch rename to base-patches/frameworks/av/0008-Change-max-width-and-height-supported-by-H.263-decod.patch diff --git a/frameworks/av/0009-FLACExtractor-Add-more-sample-rates-support.patch b/base-patches/frameworks/av/0009-FLACExtractor-Add-more-sample-rates-support.patch similarity index 100% rename from frameworks/av/0009-FLACExtractor-Add-more-sample-rates-support.patch rename to base-patches/frameworks/av/0009-FLACExtractor-Add-more-sample-rates-support.patch diff --git a/frameworks/av/0010-Don-t-use-YV12-color-format-for-video-decoding.patch b/base-patches/frameworks/av/0010-Don-t-use-YV12-color-format-for-video-decoding.patch similarity index 100% rename from frameworks/av/0010-Don-t-use-YV12-color-format-for-video-decoding.patch rename to base-patches/frameworks/av/0010-Don-t-use-YV12-color-format-for-video-decoding.patch diff --git a/frameworks/av/0011-Allow-screenrecord-usage-on-Android-x86.patch b/base-patches/frameworks/av/0011-Allow-screenrecord-usage-on-Android-x86.patch similarity index 100% rename from frameworks/av/0011-Allow-screenrecord-usage-on-Android-x86.patch rename to base-patches/frameworks/av/0011-Allow-screenrecord-usage-on-Android-x86.patch diff --git a/frameworks/av/0012-media-enable-dithering-for-RGB565-conversion.patch b/base-patches/frameworks/av/0012-media-enable-dithering-for-RGB565-conversion.patch similarity index 100% rename from frameworks/av/0012-media-enable-dithering-for-RGB565-conversion.patch rename to base-patches/frameworks/av/0012-media-enable-dithering-for-RGB565-conversion.patch diff --git a/frameworks/av/0013-nuplayer-skip-bad-SAR-values.patch b/base-patches/frameworks/av/0013-nuplayer-skip-bad-SAR-values.patch similarity index 100% rename from frameworks/av/0013-nuplayer-skip-bad-SAR-values.patch rename to base-patches/frameworks/av/0013-nuplayer-skip-bad-SAR-values.patch diff --git a/frameworks/av/0014-stagefright-Add-support-for-loading-a-custom-OMXPlug.patch b/base-patches/frameworks/av/0014-stagefright-Add-support-for-loading-a-custom-OMXPlug.patch similarity index 100% rename from frameworks/av/0014-stagefright-Add-support-for-loading-a-custom-OMXPlug.patch rename to base-patches/frameworks/av/0014-stagefright-Add-support-for-loading-a-custom-OMXPlug.patch diff --git a/frameworks/av/0015-stagefright-allow-multiple-custom-OMXPlugins.patch b/base-patches/frameworks/av/0015-stagefright-allow-multiple-custom-OMXPlugins.patch similarity index 100% rename from frameworks/av/0015-stagefright-allow-multiple-custom-OMXPlugins.patch rename to base-patches/frameworks/av/0015-stagefright-allow-multiple-custom-OMXPlugins.patch diff --git a/frameworks/av/0016-libstagefright-Extended-media-support-via-FFMPEG.patch b/base-patches/frameworks/av/0016-libstagefright-Extended-media-support-via-FFMPEG.patch similarity index 100% rename from frameworks/av/0016-libstagefright-Extended-media-support-via-FFMPEG.patch rename to base-patches/frameworks/av/0016-libstagefright-Extended-media-support-via-FFMPEG.patch diff --git a/frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch b/base-patches/frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch similarity index 100% rename from frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch rename to base-patches/frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch diff --git a/frameworks/av/0018-Setup-FFMPEG-audio-mpeg-L2-codec-correctly.patch b/base-patches/frameworks/av/0018-Setup-FFMPEG-audio-mpeg-L2-codec-correctly.patch similarity index 100% rename from frameworks/av/0018-Setup-FFMPEG-audio-mpeg-L2-codec-correctly.patch rename to base-patches/frameworks/av/0018-Setup-FFMPEG-audio-mpeg-L2-codec-correctly.patch diff --git a/frameworks/base/0001-anbox-disable-SELinux-parts.patch b/base-patches/frameworks/base/0001-anbox-disable-SELinux-parts.patch similarity index 100% rename from frameworks/base/0001-anbox-disable-SELinux-parts.patch rename to base-patches/frameworks/base/0001-anbox-disable-SELinux-parts.patch diff --git a/frameworks/base/0002-anbox-disable-suspend-control.patch b/base-patches/frameworks/base/0002-anbox-disable-suspend-control.patch similarity index 100% rename from frameworks/base/0002-anbox-disable-suspend-control.patch rename to base-patches/frameworks/base/0002-anbox-disable-suspend-control.patch diff --git a/frameworks/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch b/base-patches/frameworks/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch similarity index 100% rename from frameworks/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch rename to base-patches/frameworks/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch diff --git a/frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch b/base-patches/frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch similarity index 100% rename from frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch rename to base-patches/frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch diff --git a/frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch b/base-patches/frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch similarity index 100% rename from frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch rename to base-patches/frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch diff --git a/frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch b/base-patches/frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch similarity index 100% rename from frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch rename to base-patches/frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch diff --git a/frameworks/base/0007-core-Add-support-for-MicroG.patch b/base-patches/frameworks/base/0007-core-Add-support-for-MicroG.patch similarity index 100% rename from frameworks/base/0007-core-Add-support-for-MicroG.patch rename to base-patches/frameworks/base/0007-core-Add-support-for-MicroG.patch diff --git a/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch b/base-patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch similarity index 100% rename from frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch rename to base-patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch diff --git a/frameworks/base/0009-Zygote-Disable-seccomp.patch b/base-patches/frameworks/base/0009-Zygote-Disable-seccomp.patch similarity index 100% rename from frameworks/base/0009-Zygote-Disable-seccomp.patch rename to base-patches/frameworks/base/0009-Zygote-Disable-seccomp.patch diff --git a/frameworks/native/0001-anbox-installd-run-without-SELinux.patch b/base-patches/frameworks/native/0001-anbox-installd-run-without-SELinux.patch similarity index 100% rename from frameworks/native/0001-anbox-installd-run-without-SELinux.patch rename to base-patches/frameworks/native/0001-anbox-installd-run-without-SELinux.patch diff --git a/frameworks/native/0002-halium-disable-SELinux-checks-in-ServiceManager.patch b/base-patches/frameworks/native/0002-halium-disable-SELinux-checks-in-ServiceManager.patch similarity index 100% rename from frameworks/native/0002-halium-disable-SELinux-checks-in-ServiceManager.patch rename to base-patches/frameworks/native/0002-halium-disable-SELinux-checks-in-ServiceManager.patch diff --git a/frameworks/native/0003-halium-never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch b/base-patches/frameworks/native/0003-halium-never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch similarity index 100% rename from frameworks/native/0003-halium-never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch rename to base-patches/frameworks/native/0003-halium-never-set-FLAT_BINDER_FLAG_TXN_SECURITY_CTX-f.patch diff --git a/frameworks/native/0004-Hack-EventHub-until-it-works-with-our-fake-evdev-eve.patch b/base-patches/frameworks/native/0004-Hack-EventHub-until-it-works-with-our-fake-evdev-eve.patch similarity index 100% rename from frameworks/native/0004-Hack-EventHub-until-it-works-with-our-fake-evdev-eve.patch rename to base-patches/frameworks/native/0004-Hack-EventHub-until-it-works-with-our-fake-evdev-eve.patch diff --git a/frameworks/native/0005-surfaceflinger-Provide-layer-names-and-stuffs.patch b/base-patches/frameworks/native/0005-surfaceflinger-Provide-layer-names-and-stuffs.patch similarity index 100% rename from frameworks/native/0005-surfaceflinger-Provide-layer-names-and-stuffs.patch rename to base-patches/frameworks/native/0005-surfaceflinger-Provide-layer-names-and-stuffs.patch diff --git a/frameworks/native/0006-EventHub-Add-wayland-inputs-support.patch b/base-patches/frameworks/native/0006-EventHub-Add-wayland-inputs-support.patch similarity index 100% rename from frameworks/native/0006-EventHub-Add-wayland-inputs-support.patch rename to base-patches/frameworks/native/0006-EventHub-Add-wayland-inputs-support.patch diff --git a/frameworks/native/0007-inputflinger-add-absolute-event-support-for-cursor.patch b/base-patches/frameworks/native/0007-inputflinger-add-absolute-event-support-for-cursor.patch similarity index 100% rename from frameworks/native/0007-inputflinger-add-absolute-event-support-for-cursor.patch rename to base-patches/frameworks/native/0007-inputflinger-add-absolute-event-support-for-cursor.patch diff --git a/frameworks/native/0008-RenderEngine-support-non-RGBA_8888-format.patch b/base-patches/frameworks/native/0008-RenderEngine-support-non-RGBA_8888-format.patch similarity index 100% rename from frameworks/native/0008-RenderEngine-support-non-RGBA_8888-format.patch rename to base-patches/frameworks/native/0008-RenderEngine-support-non-RGBA_8888-format.patch diff --git a/frameworks/native/0009-libEGL-select-pixel-format-by-EGL_NATIVE_VISUAL_ID.patch b/base-patches/frameworks/native/0009-libEGL-select-pixel-format-by-EGL_NATIVE_VISUAL_ID.patch similarity index 100% rename from frameworks/native/0009-libEGL-select-pixel-format-by-EGL_NATIVE_VISUAL_ID.patch rename to base-patches/frameworks/native/0009-libEGL-select-pixel-format-by-EGL_NATIVE_VISUAL_ID.patch diff --git a/hardware/libhardware/0001-anbox-add-vendor_extra-lib-hw-to-HAL-search-path.patch b/base-patches/hardware/libhardware/0001-anbox-add-vendor_extra-lib-hw-to-HAL-search-path.patch similarity index 100% rename from hardware/libhardware/0001-anbox-add-vendor_extra-lib-hw-to-HAL-search-path.patch rename to base-patches/hardware/libhardware/0001-anbox-add-vendor_extra-lib-hw-to-HAL-search-path.patch diff --git a/hardware/libhardware/0002-libhardware-Don-t-check-for-ro.hardware.patch b/base-patches/hardware/libhardware/0002-libhardware-Don-t-check-for-ro.hardware.patch similarity index 100% rename from hardware/libhardware/0002-libhardware-Don-t-check-for-ro.hardware.patch rename to base-patches/hardware/libhardware/0002-libhardware-Don-t-check-for-ro.hardware.patch diff --git a/packages/apps/PermissionController/0001-Utils-add-FAKE_PACKAGE_SIGNATURE-to-platform-permiss.patch b/base-patches/packages/apps/PermissionController/0001-Utils-add-FAKE_PACKAGE_SIGNATURE-to-platform-permiss.patch similarity index 100% rename from packages/apps/PermissionController/0001-Utils-add-FAKE_PACKAGE_SIGNATURE-to-platform-permiss.patch rename to base-patches/packages/apps/PermissionController/0001-Utils-add-FAKE_PACKAGE_SIGNATURE-to-platform-permiss.patch diff --git a/packages/apps/Settings/0001-Settings-Disable-double_tap_sleep_gesture-by-default.patch b/base-patches/packages/apps/Settings/0001-Settings-Disable-double_tap_sleep_gesture-by-default.patch similarity index 100% rename from packages/apps/Settings/0001-Settings-Disable-double_tap_sleep_gesture-by-default.patch rename to base-patches/packages/apps/Settings/0001-Settings-Disable-double_tap_sleep_gesture-by-default.patch diff --git a/system/core/0001-anbox-init-start-inside-LXC-container-without-SELinu.patch b/base-patches/system/core/0001-anbox-init-start-inside-LXC-container-without-SELinu.patch similarity index 100% rename from system/core/0001-anbox-init-start-inside-LXC-container-without-SELinu.patch rename to base-patches/system/core/0001-anbox-init-start-inside-LXC-container-without-SELinu.patch diff --git a/system/core/0002-anbox-init-modify-mount_all-to-skip-mounts-and-trigg.patch b/base-patches/system/core/0002-anbox-init-modify-mount_all-to-skip-mounts-and-trigg.patch similarity index 100% rename from system/core/0002-anbox-init-modify-mount_all-to-skip-mounts-and-trigg.patch rename to base-patches/system/core/0002-anbox-init-modify-mount_all-to-skip-mounts-and-trigg.patch diff --git a/system/core/0003-anbox-healthd-adjust-backup-service-name-to-avoid-co.patch b/base-patches/system/core/0003-anbox-healthd-adjust-backup-service-name-to-avoid-co.patch similarity index 100% rename from system/core/0003-anbox-healthd-adjust-backup-service-name-to-avoid-co.patch rename to base-patches/system/core/0003-anbox-healthd-adjust-backup-service-name-to-avoid-co.patch diff --git a/system/core/0004-temp-anbox-temporary-disable-adbd.patch b/base-patches/system/core/0004-temp-anbox-temporary-disable-adbd.patch similarity index 100% rename from system/core/0004-temp-anbox-temporary-disable-adbd.patch rename to base-patches/system/core/0004-temp-anbox-temporary-disable-adbd.patch diff --git a/system/core/0005-anbox-add-vendor_extra-path-as-a-clone-of-vendor-ent.patch b/base-patches/system/core/0005-anbox-add-vendor_extra-path-as-a-clone-of-vendor-ent.patch similarity index 100% rename from system/core/0005-anbox-add-vendor_extra-path-as-a-clone-of-vendor-ent.patch rename to base-patches/system/core/0005-anbox-add-vendor_extra-path-as-a-clone-of-vendor-ent.patch diff --git a/system/core/0006-libsync-Add-sw_sync-symbols-to-map.patch b/base-patches/system/core/0006-libsync-Add-sw_sync-symbols-to-map.patch similarity index 100% rename from system/core/0006-libsync-Add-sw_sync-symbols-to-map.patch rename to base-patches/system/core/0006-libsync-Add-sw_sync-symbols-to-map.patch diff --git a/system/core/0007-sdcard-Bring-back-fuse.patch b/base-patches/system/core/0007-sdcard-Bring-back-fuse.patch similarity index 100% rename from system/core/0007-sdcard-Bring-back-fuse.patch rename to base-patches/system/core/0007-sdcard-Bring-back-fuse.patch diff --git a/system/core/0008-sdcard-Add-full-mount-directory.patch b/base-patches/system/core/0008-sdcard-Add-full-mount-directory.patch similarity index 100% rename from system/core/0008-sdcard-Add-full-mount-directory.patch rename to base-patches/system/core/0008-sdcard-Add-full-mount-directory.patch diff --git a/system/hardware/interfaces/0001-suspend-Set-mUseSuspendCounter-to-true.patch b/base-patches/system/hardware/interfaces/0001-suspend-Set-mUseSuspendCounter-to-true.patch similarity index 100% rename from system/hardware/interfaces/0001-suspend-Set-mUseSuspendCounter-to-true.patch rename to base-patches/system/hardware/interfaces/0001-suspend-Set-mUseSuspendCounter-to-true.patch diff --git a/system/hwservicemanager/0001-halium-disable-SELinux-parts.patch b/base-patches/system/hwservicemanager/0001-halium-disable-SELinux-parts.patch similarity index 100% rename from system/hwservicemanager/0001-halium-disable-SELinux-parts.patch rename to base-patches/system/hwservicemanager/0001-halium-disable-SELinux-parts.patch diff --git a/system/netd/0001-netd-Fix-networking.patch b/base-patches/system/netd/0001-netd-Fix-networking.patch similarity index 100% rename from system/netd/0001-netd-Fix-networking.patch rename to base-patches/system/netd/0001-netd-Fix-networking.patch diff --git a/system/nfc/0001-nfc-Add-host-search-paths.patch b/base-patches/system/nfc/0001-nfc-Add-host-search-paths.patch similarity index 100% rename from system/nfc/0001-nfc-Add-host-search-paths.patch rename to base-patches/system/nfc/0001-nfc-Add-host-search-paths.patch diff --git a/system/security/0001-keystore-Supress-SELinux-errors.patch b/base-patches/system/security/0001-keystore-Supress-SELinux-errors.patch similarity index 100% rename from system/security/0001-keystore-Supress-SELinux-errors.patch rename to base-patches/system/security/0001-keystore-Supress-SELinux-errors.patch diff --git a/system/tools/hidl/0001-anbox-Allow-host_hwbinder-to-be-used-for-HALs.patch b/base-patches/system/tools/hidl/0001-anbox-Allow-host_hwbinder-to-be-used-for-HALs.patch similarity index 100% rename from system/tools/hidl/0001-anbox-Allow-host_hwbinder-to-be-used-for-HALs.patch rename to base-patches/system/tools/hidl/0001-anbox-Allow-host_hwbinder-to-be-used-for-HALs.patch diff --git a/system/vold/0001-vold-Fix-fuse-sdcard.patch b/base-patches/system/vold/0001-vold-Fix-fuse-sdcard.patch similarity index 100% rename from system/vold/0001-vold-Fix-fuse-sdcard.patch rename to base-patches/system/vold/0001-vold-Fix-fuse-sdcard.patch diff --git a/system/vold/0002-vold-Drop-selinux-checks-on-prepare_subdirs.patch b/base-patches/system/vold/0002-vold-Drop-selinux-checks-on-prepare_subdirs.patch similarity index 100% rename from system/vold/0002-vold-Drop-selinux-checks-on-prepare_subdirs.patch rename to base-patches/system/vold/0002-vold-Drop-selinux-checks-on-prepare_subdirs.patch diff --git a/system/vold/0003-Revert-Remove-waitpid-on-UnMount.patch b/base-patches/system/vold/0003-Revert-Remove-waitpid-on-UnMount.patch similarity index 100% rename from system/vold/0003-Revert-Remove-waitpid-on-UnMount.patch rename to base-patches/system/vold/0003-Revert-Remove-waitpid-on-UnMount.patch diff --git a/bliss/patches/frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch b/bliss/patches/frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch new file mode 100644 index 0000000..e1fe96f --- /dev/null +++ b/bliss/patches/frameworks/av/0017-Add-paths-and-system-libraries-for-swcodec-APEX.patch @@ -0,0 +1,40 @@ +From 34c505527d08a7cef1e1b22eee67b615bc0fa584 Mon Sep 17 00:00:00 2001 +From: Michael Goffioul +Date: Fri, 4 Oct 2019 20:12:57 -0400 +Subject: [PATCH] Add paths and system libraries for swcodec APEX + +- libdrm.so, libhardware_legacy.so: required by drm_gralloc +- libashmemd_client.so: suppress recurring error messages in logcat, + maybe not required from functionality point of view +- /apex/com.android.media.swcodec/${LIB}: required for + android.hardware.graphics.mapper@2.0.so +--- + apex/ld.config.txt | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/apex/ld.config.txt b/apex/ld.config.txt +index 029754b47a..7d3c4d18b9 100644 +--- a/apex/ld.config.txt ++++ b/apex/ld.config.txt +@@ -65,7 +65,8 @@ namespace.sphal.visible = true + # Keep the below in sync with "sphal" namespace in system's /etc/ld.config.txt + # Codec2 has dependencies on some SP-hals (eg. android.hardware.graphics.mapper@2.0) + # These are dlopen'ed by libvndksupport.so. +-namespace.sphal.search.paths = /odm/${LIB} ++namespace.sphal.search.paths = /apex/com.android.media.swcodec/${LIB} ++namespace.sphal.search.paths += /odm/${LIB} + namespace.sphal.search.paths += /vendor/${LIB} + namespace.sphal.search.paths += /vendor_extra/${LIB} + +@@ -143,7 +144,7 @@ namespace.sphal.links = platform + # TODO: replace the following when apex has a way to auto-generate this list + # namespace.sphal.link.platform.shared_libs = %LLNDK_LIBRARIES% + # namespace.sphal.link.platform.shared_libs += %SANITIZER_RUNTIME_LIBRARIES% +-namespace.sphal.link.platform.shared_libs = libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libRS.so:libandroid_net.so:libc.so:libcgrouprc.so:libclang_rt.asan-aarch64-android.so:libclang_rt.asan-arm-android.so:libclang_rt.hwasan-aarch64-android.so:libclang_rt.asan-i686-android.so:libclang_rt.asan-x86_64-android.so:libdl.so:libft2.so:liblog.so:libm.so:libmediandk.so:libnativewindow.so:libneuralnetworks.so:libsync.so:libvndksupport.so:libvulkan.so ++namespace.sphal.link.platform.shared_libs = libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libRS.so:libandroid_net.so:libc.so:libcgrouprc.so:libclang_rt.asan-aarch64-android.so:libclang_rt.asan-arm-android.so:libclang_rt.hwasan-aarch64-android.so:libclang_rt.asan-i686-android.so:libclang_rt.asan-x86_64-android.so:libdl.so:libft2.so:liblog.so:libm.so:libmediandk.so:libnativewindow.so:libneuralnetworks.so:libsync.so:libvndksupport.so:libvulkan.so:libashmemd_client.so:libdrm.so:libhardware_legacy.so + + # Add a link for libz.so which is llndk on devices where VNDK is not enforced. + namespace.sphal.link.platform.shared_libs += libz.so +-- +2.20.1 + diff --git a/bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch b/bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch new file mode 100644 index 0000000..09a1e44 --- /dev/null +++ b/bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch @@ -0,0 +1,92 @@ +From a671d56cf632a52fbb466f3672d0f93b6e3b40de Mon Sep 17 00:00:00 2001 +From: gudenau +Date: Tue, 25 Sep 2018 09:44:26 +0200 +Subject: [PATCH 1/2] core: Add support for MicroG + +-fake signatures, enabled per app by dynamic permission + +Change-Id: I84fc7e5c606f4b57012d948a4cc6cb521db6b03e +--- + core/res/AndroidManifest.xml | 7 ++++++ + core/res/res/values/cm_strings.xml | 6 +++++ + .../server/pm/PackageManagerService.java | 24 ++++++++++++++++--- + 3 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml +index 316496d28a9..29450170b6c 100644 +--- a/core/res/AndroidManifest.xml ++++ b/core/res/AndroidManifest.xml +@@ -2688,6 +2688,13 @@ + android:label="@string/permlab_fakePackageSignature" + android:description="@string/permdesc_fakePackageSignature" /> + ++ ++ ++ + +diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml +index 972ed01636d..9c55e4428b4 100644 +--- a/core/res/res/values/cm_strings.xml ++++ b/core/res/res/values/cm_strings.xml +@@ -29,4 +29,10 @@ + + Bluetooth will stay on during airplane mode + ++ ++ Spoof package signature ++ ++ Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only! ++ + +diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java +index 68b6b51c356..c363e0b45e7 100644 +--- a/services/core/java/com/android/server/pm/PackageManagerService.java ++++ b/services/core/java/com/android/server/pm/PackageManagerService.java +@@ -4208,9 +4208,9 @@ public class PackageManagerService extends IPackageManager.Stub + final Set permissions = ArrayUtils.isEmpty(p.requestedPermissions) + ? Collections.emptySet() : permissionsState.getPermissions(userId); + +- PackageInfo packageInfo = mayFakeSignature(p, PackageParser +- .generatePackageInfo(p, gids, flags, ps.firstInstallTime, +- ps.lastUpdateTime, permissions, state, userId), permissions); ++ PackageInfo packageInfo = mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags, ++ ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId), ++ permissions); + + if (packageInfo == null) { + return null; +@@ -4266,6 +4266,24 @@ public class PackageManagerService extends IPackageManager.Stub + return pi; + } + ++ private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi, ++ Set permissions) { ++ try { ++ if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") ++ && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1 ++ && p.mAppMetaData != null) { ++ String sig = p.mAppMetaData.getString("fake-signature"); ++ if (sig != null) { ++ pi.signatures = new Signature[] {new Signature(sig)}; ++ } ++ } ++ } catch (Throwable t) { ++ // We should never die because of any failures, this is system code! ++ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t); ++ } ++ return pi; ++ } ++ + @Override + public void checkPackageStartable(String packageName, int userId) { + final int callingUid = Binder.getCallingUid(); +-- +2.20.1 + diff --git a/bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch b/bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch new file mode 100644 index 0000000..7763970 --- /dev/null +++ b/bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch @@ -0,0 +1,56 @@ +From 808ce78e3f004671e5e0e30515055f2f80ca0cab Mon Sep 17 00:00:00 2001 +From: Vachounet +Date: Wed, 12 Feb 2020 11:34:33 +0100 +Subject: [PATCH 2/2] AndroidManifest: add a permission group for signature + spoofing + +Needed by PackageInstaller while checking for modern permission group + +Change-Id: Ibb402960dcde6d21106d1481ca7c3cd314fd2ac1 +--- + core/res/AndroidManifest.xml | 8 ++++++++ + core/res/res/values/cm_strings.xml | 7 +++++++ + 2 files changed, 15 insertions(+) + +diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml +index 29450170b6c..044eeed257a 100644 +--- a/core/res/AndroidManifest.xml ++++ b/core/res/AndroidManifest.xml +@@ -2688,9 +2688,17 @@ + android:label="@string/permlab_fakePackageSignature" + android:description="@string/permdesc_fakePackageSignature" /> + ++ ++ ++ + + +diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml +index 9c55e4428b4..674583b3a0e 100644 +--- a/core/res/res/values/cm_strings.xml ++++ b/core/res/res/values/cm_strings.xml +@@ -34,5 +34,12 @@ + + Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only! ++ ++ Spoof package signature ++ ++ allow to spoof package signature ++ ++ Allow ++ <b>%1$s</b> to spoof package signature? + + +-- +2.20.1 + diff --git a/lineage/patches/build/external/wayland-protocols/0001-stable-Add-xdg-shell.patch b/lineage/patches/build/external/wayland-protocols/0001-stable-Add-xdg-shell.patch new file mode 100644 index 0000000..64c24f7 --- /dev/null +++ b/lineage/patches/build/external/wayland-protocols/0001-stable-Add-xdg-shell.patch @@ -0,0 +1,1900 @@ +From f84cb5c81d834e283934f53b72889bf731722710 Mon Sep 17 00:00:00 2001 +From: Erfan Abdi +Date: Wed, 16 Jun 2021 22:10:33 +0800 +Subject: [PATCH] stable: Add xdg-shell + +Change-Id: I0fde1fbc61c64fdb607250665faf1887dd9bf575 +--- + .../stable/xdg-shell/xdg-shell.xml | 1249 +++++++++++++++++ + .../xdg-shell/xdg-shell-unstable-v5.xml | 623 -------- + 2 files changed, 1249 insertions(+), 623 deletions(-) + create mode 100644 freedesktop.org/stable/xdg-shell/xdg-shell.xml + delete mode 100644 freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v5.xml + +diff --git a/freedesktop.org/stable/xdg-shell/xdg-shell.xml b/freedesktop.org/stable/xdg-shell/xdg-shell.xml +new file mode 100644 +index 0000000..ae8ab67 +--- /dev/null ++++ b/freedesktop.org/stable/xdg-shell/xdg-shell.xml +@@ -0,0 +1,1249 @@ ++ ++ ++ ++ ++ Copyright © 2008-2013 Kristian Høgsberg ++ Copyright © 2013 Rafael Antognolli ++ Copyright © 2013 Jasper St. Pierre ++ Copyright © 2010-2013 Intel Corporation ++ Copyright © 2015-2017 Samsung Electronics Co., Ltd ++ Copyright © 2015-2017 Red Hat Inc. ++ ++ Permission is hereby granted, free of charge, to any person obtaining a ++ copy of this software and associated documentation files (the "Software"), ++ to deal in the Software without restriction, including without limitation ++ the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ and/or sell copies of the Software, and to permit persons to whom the ++ Software is furnished to do so, subject to the following conditions: ++ ++ The above copyright notice and this permission notice (including the next ++ paragraph) shall be included in all copies or substantial portions of the ++ Software. ++ ++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ DEALINGS IN THE SOFTWARE. ++ ++ ++ ++ ++ The xdg_wm_base interface is exposed as a global object enabling clients ++ to turn their wl_surfaces into windows in a desktop environment. It ++ defines the basic functionality needed for clients and the compositor to ++ create windows that can be dragged, resized, maximized, etc, as well as ++ creating transient windows such as popup menus. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Destroy this xdg_wm_base object. ++ ++ Destroying a bound xdg_wm_base object while there are surfaces ++ still alive created by this xdg_wm_base object instance is illegal ++ and will result in a protocol error. ++ ++ ++ ++ ++ ++ Create a positioner object. A positioner object is used to position ++ surfaces relative to some parent surface. See the interface description ++ and xdg_surface.get_popup for details. ++ ++ ++ ++ ++ ++ ++ This creates an xdg_surface for the given surface. While xdg_surface ++ itself is not a role, the corresponding surface may only be assigned ++ a role extending xdg_surface, such as xdg_toplevel or xdg_popup. ++ ++ This creates an xdg_surface for the given surface. An xdg_surface is ++ used as basis to define a role to a given surface, such as xdg_toplevel ++ or xdg_popup. It also manages functionality shared between xdg_surface ++ based surface roles. ++ ++ See the documentation of xdg_surface for more details about what an ++ xdg_surface is and how it is used. ++ ++ ++ ++ ++ ++ ++ ++ A client must respond to a ping event with a pong request or ++ the client may be deemed unresponsive. See xdg_wm_base.ping. ++ ++ ++ ++ ++ ++ ++ The ping event asks the client if it's still alive. Pass the ++ serial specified in the event back to the compositor by sending ++ a "pong" request back with the specified serial. See xdg_wm_base.pong. ++ ++ Compositors can use this to determine if the client is still ++ alive. It's unspecified what will happen if the client doesn't ++ respond to the ping request, or in what timeframe. Clients should ++ try to respond in a reasonable amount of time. ++ ++ A compositor is free to ping in any way it wants, but a client must ++ always respond to any xdg_wm_base object it created. ++ ++ ++ ++ ++ ++ ++ ++ The xdg_positioner provides a collection of rules for the placement of a ++ child surface relative to a parent surface. Rules can be defined to ensure ++ the child surface remains within the visible area's borders, and to ++ specify how the child surface changes its position, such as sliding along ++ an axis, or flipping around a rectangle. These positioner-created rules are ++ constrained by the requirement that a child surface must intersect with or ++ be at least partially adjacent to its parent surface. ++ ++ See the various requests for details about possible rules. ++ ++ At the time of the request, the compositor makes a copy of the rules ++ specified by the xdg_positioner. Thus, after the request is complete the ++ xdg_positioner object can be destroyed or reused; further changes to the ++ object will have no effect on previous usages. ++ ++ For an xdg_positioner object to be considered complete, it must have a ++ non-zero size set by set_size, and a non-zero anchor rectangle set by ++ set_anchor_rect. Passing an incomplete xdg_positioner object when ++ positioning a surface raises an error. ++ ++ ++ ++ ++ ++ ++ ++ ++ Notify the compositor that the xdg_positioner will no longer be used. ++ ++ ++ ++ ++ ++ Set the size of the surface that is to be positioned with the positioner ++ object. The size is in surface-local coordinates and corresponds to the ++ window geometry. See xdg_surface.set_window_geometry. ++ ++ If a zero or negative size is set the invalid_input error is raised. ++ ++ ++ ++ ++ ++ ++ ++ Specify the anchor rectangle within the parent surface that the child ++ surface will be placed relative to. The rectangle is relative to the ++ window geometry as defined by xdg_surface.set_window_geometry of the ++ parent surface. ++ ++ When the xdg_positioner object is used to position a child surface, the ++ anchor rectangle may not extend outside the window geometry of the ++ positioned child's parent surface. ++ ++ If a negative size is set the invalid_input error is raised. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Defines the anchor point for the anchor rectangle. The specified anchor ++ is used derive an anchor point that the child surface will be ++ positioned relative to. If a corner anchor is set (e.g. 'top_left' or ++ 'bottom_right'), the anchor point will be at the specified corner; ++ otherwise, the derived anchor point will be centered on the specified ++ edge, or in the center of the anchor rectangle if no edge is specified. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Defines in what direction a surface should be positioned, relative to ++ the anchor point of the parent surface. If a corner gravity is ++ specified (e.g. 'bottom_right' or 'top_left'), then the child surface ++ will be placed towards the specified gravity; otherwise, the child ++ surface will be centered over the anchor point on any axis that had no ++ gravity specified. ++ ++ ++ ++ ++ ++ ++ The constraint adjustment value define ways the compositor will adjust ++ the position of the surface, if the unadjusted position would result ++ in the surface being partly constrained. ++ ++ Whether a surface is considered 'constrained' is left to the compositor ++ to determine. For example, the surface may be partly outside the ++ compositor's defined 'work area', thus necessitating the child surface's ++ position be adjusted until it is entirely inside the work area. ++ ++ The adjustments can be combined, according to a defined precedence: 1) ++ Flip, 2) Slide, 3) Resize. ++ ++ ++ ++ Don't alter the surface position even if it is constrained on some ++ axis, for example partially outside the edge of an output. ++ ++ ++ ++ ++ Slide the surface along the x axis until it is no longer constrained. ++ ++ First try to slide towards the direction of the gravity on the x axis ++ until either the edge in the opposite direction of the gravity is ++ unconstrained or the edge in the direction of the gravity is ++ constrained. ++ ++ Then try to slide towards the opposite direction of the gravity on the ++ x axis until either the edge in the direction of the gravity is ++ unconstrained or the edge in the opposite direction of the gravity is ++ constrained. ++ ++ ++ ++ ++ Slide the surface along the y axis until it is no longer constrained. ++ ++ First try to slide towards the direction of the gravity on the y axis ++ until either the edge in the opposite direction of the gravity is ++ unconstrained or the edge in the direction of the gravity is ++ constrained. ++ ++ Then try to slide towards the opposite direction of the gravity on the ++ y axis until either the edge in the direction of the gravity is ++ unconstrained or the edge in the opposite direction of the gravity is ++ constrained. ++ ++ ++ ++ ++ Invert the anchor and gravity on the x axis if the surface is ++ constrained on the x axis. For example, if the left edge of the ++ surface is constrained, the gravity is 'left' and the anchor is ++ 'left', change the gravity to 'right' and the anchor to 'right'. ++ ++ If the adjusted position also ends up being constrained, the resulting ++ position of the flip_x adjustment will be the one before the ++ adjustment. ++ ++ ++ ++ ++ Invert the anchor and gravity on the y axis if the surface is ++ constrained on the y axis. For example, if the bottom edge of the ++ surface is constrained, the gravity is 'bottom' and the anchor is ++ 'bottom', change the gravity to 'top' and the anchor to 'top'. ++ ++ The adjusted position is calculated given the original anchor ++ rectangle and offset, but with the new flipped anchor and gravity ++ values. ++ ++ If the adjusted position also ends up being constrained, the resulting ++ position of the flip_y adjustment will be the one before the ++ adjustment. ++ ++ ++ ++ ++ Resize the surface horizontally so that it is completely ++ unconstrained. ++ ++ ++ ++ ++ Resize the surface vertically so that it is completely unconstrained. ++ ++ ++ ++ ++ ++ ++ Specify how the window should be positioned if the originally intended ++ position caused the surface to be constrained, meaning at least ++ partially outside positioning boundaries set by the compositor. The ++ adjustment is set by constructing a bitmask describing the adjustment to ++ be made when the surface is constrained on that axis. ++ ++ If no bit for one axis is set, the compositor will assume that the child ++ surface should not change its position on that axis when constrained. ++ ++ If more than one bit for one axis is set, the order of how adjustments ++ are applied is specified in the corresponding adjustment descriptions. ++ ++ The default adjustment is none. ++ ++ ++ ++ ++ ++ ++ Specify the surface position offset relative to the position of the ++ anchor on the anchor rectangle and the anchor on the surface. For ++ example if the anchor of the anchor rectangle is at (x, y), the surface ++ has the gravity bottom|right, and the offset is (ox, oy), the calculated ++ surface position will be (x + ox, y + oy). The offset position of the ++ surface is the one used for constraint testing. See ++ set_constraint_adjustment. ++ ++ An example use case is placing a popup menu on top of a user interface ++ element, while aligning the user interface element of the parent surface ++ with some user interface element placed somewhere in the popup surface. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ When set reactive, the surface is reconstrained if the conditions used ++ for constraining changed, e.g. the parent window moved. ++ ++ If the conditions changed and the popup was reconstrained, an ++ xdg_popup.configure event is sent with updated geometry, followed by an ++ xdg_surface.configure event. ++ ++ ++ ++ ++ ++ Set the parent window geometry the compositor should use when ++ positioning the popup. The compositor may use this information to ++ determine the future state the popup should be constrained using. If ++ this doesn't match the dimension of the parent the popup is eventually ++ positioned against, the behavior is undefined. ++ ++ The arguments are given in the surface-local coordinate space. ++ ++ ++ ++ ++ ++ ++ ++ Set the serial of an xdg_surface.configure event this positioner will be ++ used in response to. The compositor may use this information together ++ with set_parent_size to determine what future state the popup should be ++ constrained using. ++ ++ ++ ++ ++ ++ ++ ++ An interface that may be implemented by a wl_surface, for ++ implementations that provide a desktop-style user interface. ++ ++ It provides a base set of functionality required to construct user ++ interface elements requiring management by the compositor, such as ++ toplevel windows, menus, etc. The types of functionality are split into ++ xdg_surface roles. ++ ++ Creating an xdg_surface does not set the role for a wl_surface. In order ++ to map an xdg_surface, the client must create a role-specific object ++ using, e.g., get_toplevel, get_popup. The wl_surface for any given ++ xdg_surface can have at most one role, and may not be assigned any role ++ not based on xdg_surface. ++ ++ A role must be assigned before any other requests are made to the ++ xdg_surface object. ++ ++ The client must call wl_surface.commit on the corresponding wl_surface ++ for the xdg_surface state to take effect. ++ ++ Creating an xdg_surface from a wl_surface which has a buffer attached or ++ committed is a client error, and any attempts by a client to attach or ++ manipulate a buffer prior to the first xdg_surface.configure call must ++ also be treated as errors. ++ ++ After creating a role-specific object and setting it up, the client must ++ perform an initial commit without any buffer attached. The compositor ++ will reply with an xdg_surface.configure event. The client must ++ acknowledge it and is then allowed to attach a buffer to map the surface. ++ ++ Mapping an xdg_surface-based role surface is defined as making it ++ possible for the surface to be shown by the compositor. Note that ++ a mapped surface is not guaranteed to be visible once it is mapped. ++ ++ For an xdg_surface to be mapped by the compositor, the following ++ conditions must be met: ++ (1) the client has assigned an xdg_surface-based role to the surface ++ (2) the client has set and committed the xdg_surface state and the ++ role-dependent state to the surface ++ (3) the client has committed a buffer to the surface ++ ++ A newly-unmapped surface is considered to have met condition (1) out ++ of the 3 required conditions for mapping a surface if its role surface ++ has not been destroyed. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Destroy the xdg_surface object. An xdg_surface must only be destroyed ++ after its role object has been destroyed. ++ ++ ++ ++ ++ ++ This creates an xdg_toplevel object for the given xdg_surface and gives ++ the associated wl_surface the xdg_toplevel role. ++ ++ See the documentation of xdg_toplevel for more details about what an ++ xdg_toplevel is and how it is used. ++ ++ ++ ++ ++ ++ ++ This creates an xdg_popup object for the given xdg_surface and gives ++ the associated wl_surface the xdg_popup role. ++ ++ If null is passed as a parent, a parent surface must be specified using ++ some other protocol, before committing the initial state. ++ ++ See the documentation of xdg_popup for more details about what an ++ xdg_popup is and how it is used. ++ ++ ++ ++ ++ ++ ++ ++ ++ The window geometry of a surface is its "visible bounds" from the ++ user's perspective. Client-side decorations often have invisible ++ portions like drop-shadows which should be ignored for the ++ purposes of aligning, placing and constraining windows. ++ ++ The window geometry is double buffered, and will be applied at the ++ time wl_surface.commit of the corresponding wl_surface is called. ++ ++ When maintaining a position, the compositor should treat the (x, y) ++ coordinate of the window geometry as the top left corner of the window. ++ A client changing the (x, y) window geometry coordinate should in ++ general not alter the position of the window. ++ ++ Once the window geometry of the surface is set, it is not possible to ++ unset it, and it will remain the same until set_window_geometry is ++ called again, even if a new subsurface or buffer is attached. ++ ++ If never set, the value is the full bounds of the surface, ++ including any subsurfaces. This updates dynamically on every ++ commit. This unset is meant for extremely simple clients. ++ ++ The arguments are given in the surface-local coordinate space of ++ the wl_surface associated with this xdg_surface. ++ ++ The width and height must be greater than zero. Setting an invalid size ++ will raise an error. When applied, the effective window geometry will be ++ the set window geometry clamped to the bounding rectangle of the ++ combined geometry of the surface of the xdg_surface and the associated ++ subsurfaces. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ When a configure event is received, if a client commits the ++ surface in response to the configure event, then the client ++ must make an ack_configure request sometime before the commit ++ request, passing along the serial of the configure event. ++ ++ For instance, for toplevel surfaces the compositor might use this ++ information to move a surface to the top left only when the client has ++ drawn itself for the maximized or fullscreen state. ++ ++ If the client receives multiple configure events before it ++ can respond to one, it only has to ack the last configure event. ++ ++ A client is not required to commit immediately after sending ++ an ack_configure request - it may even ack_configure several times ++ before its next surface commit. ++ ++ A client may send multiple ack_configure requests before committing, but ++ only the last request sent before a commit indicates which configure ++ event the client really is responding to. ++ ++ ++ ++ ++ ++ ++ The configure event marks the end of a configure sequence. A configure ++ sequence is a set of one or more events configuring the state of the ++ xdg_surface, including the final xdg_surface.configure event. ++ ++ Where applicable, xdg_surface surface roles will during a configure ++ sequence extend this event as a latched state sent as events before the ++ xdg_surface.configure event. Such events should be considered to make up ++ a set of atomically applied configuration states, where the ++ xdg_surface.configure commits the accumulated state. ++ ++ Clients should arrange their surface for the new states, and then send ++ an ack_configure request with the serial sent in this configure event at ++ some point before committing the new surface. ++ ++ If the client receives multiple configure events before it can respond ++ to one, it is free to discard all but the last event it received. ++ ++ ++ ++ ++ ++ ++ ++ ++ This interface defines an xdg_surface role which allows a surface to, ++ among other things, set window-like properties such as maximize, ++ fullscreen, and minimize, set application-specific metadata like title and ++ id, and well as trigger user interactive operations such as interactive ++ resize and move. ++ ++ Unmapping an xdg_toplevel means that the surface cannot be shown ++ by the compositor until it is explicitly mapped again. ++ All active operations (e.g., move, resize) are canceled and all ++ attributes (e.g. title, state, stacking, ...) are discarded for ++ an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to ++ the state it had right after xdg_surface.get_toplevel. The client ++ can re-map the toplevel by perfoming a commit without any buffer ++ attached, waiting for a configure event and handling it as usual (see ++ xdg_surface description). ++ ++ Attaching a null buffer to a toplevel unmaps the surface. ++ ++ ++ ++ ++ This request destroys the role surface and unmaps the surface; ++ see "Unmapping" behavior in interface section for details. ++ ++ ++ ++ ++ ++ Set the "parent" of this surface. This surface should be stacked ++ above the parent surface and all other ancestor surfaces. ++ ++ Parent windows should be set on dialogs, toolboxes, or other ++ "auxiliary" surfaces, so that the parent is raised when the dialog ++ is raised. ++ ++ Setting a null parent for a child window removes any parent-child ++ relationship for the child. Setting a null parent for a window which ++ currently has no parent is a no-op. ++ ++ If the parent is unmapped then its children are managed as ++ though the parent of the now-unmapped parent has become the ++ parent of this surface. If no parent exists for the now-unmapped ++ parent then the children are managed as though they have no ++ parent surface. ++ ++ ++ ++ ++ ++ ++ Set a short title for the surface. ++ ++ This string may be used to identify the surface in a task bar, ++ window list, or other user interface elements provided by the ++ compositor. ++ ++ The string must be encoded in UTF-8. ++ ++ ++ ++ ++ ++ ++ Set an application identifier for the surface. ++ ++ The app ID identifies the general class of applications to which ++ the surface belongs. The compositor can use this to group multiple ++ surfaces together, or to determine how to launch a new application. ++ ++ For D-Bus activatable applications, the app ID is used as the D-Bus ++ service name. ++ ++ The compositor shell will try to group application surfaces together ++ by their app ID. As a best practice, it is suggested to select app ++ ID's that match the basename of the application's .desktop file. ++ For example, "org.freedesktop.FooViewer" where the .desktop file is ++ "org.freedesktop.FooViewer.desktop". ++ ++ Like other properties, a set_app_id request can be sent after the ++ xdg_toplevel has been mapped to update the property. ++ ++ See the desktop-entry specification [0] for more details on ++ application identifiers and how they relate to well-known D-Bus ++ names and .desktop files. ++ ++ [0] http://standards.freedesktop.org/desktop-entry-spec/ ++ ++ ++ ++ ++ ++ ++ Clients implementing client-side decorations might want to show ++ a context menu when right-clicking on the decorations, giving the ++ user a menu that they can use to maximize or minimize the window. ++ ++ This request asks the compositor to pop up such a window menu at ++ the given position, relative to the local surface coordinates of ++ the parent surface. There are no guarantees as to what menu items ++ the window menu contains. ++ ++ This request must be used in response to some sort of user action ++ like a button press, key press, or touch down event. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Start an interactive, user-driven move of the surface. ++ ++ This request must be used in response to some sort of user action ++ like a button press, key press, or touch down event. The passed ++ serial is used to determine the type of interactive move (touch, ++ pointer, etc). ++ ++ The server may ignore move requests depending on the state of ++ the surface (e.g. fullscreen or maximized), or if the passed serial ++ is no longer valid. ++ ++ If triggered, the surface will lose the focus of the device ++ (wl_pointer, wl_touch, etc) used for the move. It is up to the ++ compositor to visually indicate that the move is taking place, such as ++ updating a pointer cursor, during the move. There is no guarantee ++ that the device focus will return when the move is completed. ++ ++ ++ ++ ++ ++ ++ ++ These values are used to indicate which edge of a surface ++ is being dragged in a resize operation. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Start a user-driven, interactive resize of the surface. ++ ++ This request must be used in response to some sort of user action ++ like a button press, key press, or touch down event. The passed ++ serial is used to determine the type of interactive resize (touch, ++ pointer, etc). ++ ++ The server may ignore resize requests depending on the state of ++ the surface (e.g. fullscreen or maximized). ++ ++ If triggered, the client will receive configure events with the ++ "resize" state enum value and the expected sizes. See the "resize" ++ enum value for more details about what is required. The client ++ must also acknowledge configure events using "ack_configure". After ++ the resize is completed, the client will receive another "configure" ++ event without the resize state. ++ ++ If triggered, the surface also will lose the focus of the device ++ (wl_pointer, wl_touch, etc) used for the resize. It is up to the ++ compositor to visually indicate that the resize is taking place, ++ such as updating a pointer cursor, during the resize. There is no ++ guarantee that the device focus will return when the resize is ++ completed. ++ ++ The edges parameter specifies how the surface should be resized, ++ and is one of the values of the resize_edge enum. The compositor ++ may use this information to update the surface position for ++ example when dragging the top left corner. The compositor may also ++ use this information to adapt its behavior, e.g. choose an ++ appropriate cursor image. ++ ++ ++ ++ ++ ++ ++ ++ ++ The different state values used on the surface. This is designed for ++ state values like maximized, fullscreen. It is paired with the ++ configure event to ensure that both the client and the compositor ++ setting the state can be synchronized. ++ ++ States set in this way are double-buffered. They will get applied on ++ the next commit. ++ ++ ++ ++ The surface is maximized. The window geometry specified in the configure ++ event must be obeyed by the client. ++ ++ The client should draw without shadow or other ++ decoration outside of the window geometry. ++ ++ ++ ++ ++ The surface is fullscreen. The window geometry specified in the ++ configure event is a maximum; the client cannot resize beyond it. For ++ a surface to cover the whole fullscreened area, the geometry ++ dimensions must be obeyed by the client. For more details, see ++ xdg_toplevel.set_fullscreen. ++ ++ ++ ++ ++ The surface is being resized. The window geometry specified in the ++ configure event is a maximum; the client cannot resize beyond it. ++ Clients that have aspect ratio or cell sizing configuration can use ++ a smaller size, however. ++ ++ ++ ++ ++ Client window decorations should be painted as if the window is ++ active. Do not assume this means that the window actually has ++ keyboard or pointer focus. ++ ++ ++ ++ ++ The window is currently in a tiled layout and the left edge is ++ considered to be adjacent to another part of the tiling grid. ++ ++ ++ ++ ++ The window is currently in a tiled layout and the right edge is ++ considered to be adjacent to another part of the tiling grid. ++ ++ ++ ++ ++ The window is currently in a tiled layout and the top edge is ++ considered to be adjacent to another part of the tiling grid. ++ ++ ++ ++ ++ The window is currently in a tiled layout and the bottom edge is ++ considered to be adjacent to another part of the tiling grid. ++ ++ ++ ++ ++ ++ ++ Set a maximum size for the window. ++ ++ The client can specify a maximum size so that the compositor does ++ not try to configure the window beyond this size. ++ ++ The width and height arguments are in window geometry coordinates. ++ See xdg_surface.set_window_geometry. ++ ++ Values set in this way are double-buffered. They will get applied ++ on the next commit. ++ ++ The compositor can use this information to allow or disallow ++ different states like maximize or fullscreen and draw accurate ++ animations. ++ ++ Similarly, a tiling window manager may use this information to ++ place and resize client windows in a more effective way. ++ ++ The client should not rely on the compositor to obey the maximum ++ size. The compositor may decide to ignore the values set by the ++ client and request a larger size. ++ ++ If never set, or a value of zero in the request, means that the ++ client has no expected maximum size in the given dimension. ++ As a result, a client wishing to reset the maximum size ++ to an unspecified state can use zero for width and height in the ++ request. ++ ++ Requesting a maximum size to be smaller than the minimum size of ++ a surface is illegal and will result in a protocol error. ++ ++ The width and height must be greater than or equal to zero. Using ++ strictly negative values for width and height will result in a ++ protocol error. ++ ++ ++ ++ ++ ++ ++ ++ Set a minimum size for the window. ++ ++ The client can specify a minimum size so that the compositor does ++ not try to configure the window below this size. ++ ++ The width and height arguments are in window geometry coordinates. ++ See xdg_surface.set_window_geometry. ++ ++ Values set in this way are double-buffered. They will get applied ++ on the next commit. ++ ++ The compositor can use this information to allow or disallow ++ different states like maximize or fullscreen and draw accurate ++ animations. ++ ++ Similarly, a tiling window manager may use this information to ++ place and resize client windows in a more effective way. ++ ++ The client should not rely on the compositor to obey the minimum ++ size. The compositor may decide to ignore the values set by the ++ client and request a smaller size. ++ ++ If never set, or a value of zero in the request, means that the ++ client has no expected minimum size in the given dimension. ++ As a result, a client wishing to reset the minimum size ++ to an unspecified state can use zero for width and height in the ++ request. ++ ++ Requesting a minimum size to be larger than the maximum size of ++ a surface is illegal and will result in a protocol error. ++ ++ The width and height must be greater than or equal to zero. Using ++ strictly negative values for width and height will result in a ++ protocol error. ++ ++ ++ ++ ++ ++ ++ ++ Maximize the surface. ++ ++ After requesting that the surface should be maximized, the compositor ++ will respond by emitting a configure event. Whether this configure ++ actually sets the window maximized is subject to compositor policies. ++ The client must then update its content, drawing in the configured ++ state. The client must also acknowledge the configure when committing ++ the new content (see ack_configure). ++ ++ It is up to the compositor to decide how and where to maximize the ++ surface, for example which output and what region of the screen should ++ be used. ++ ++ If the surface was already maximized, the compositor will still emit ++ a configure event with the "maximized" state. ++ ++ If the surface is in a fullscreen state, this request has no direct ++ effect. It may alter the state the surface is returned to when ++ unmaximized unless overridden by the compositor. ++ ++ ++ ++ ++ ++ Unmaximize the surface. ++ ++ After requesting that the surface should be unmaximized, the compositor ++ will respond by emitting a configure event. Whether this actually ++ un-maximizes the window is subject to compositor policies. ++ If available and applicable, the compositor will include the window ++ geometry dimensions the window had prior to being maximized in the ++ configure event. The client must then update its content, drawing it in ++ the configured state. The client must also acknowledge the configure ++ when committing the new content (see ack_configure). ++ ++ It is up to the compositor to position the surface after it was ++ unmaximized; usually the position the surface had before maximizing, if ++ applicable. ++ ++ If the surface was already not maximized, the compositor will still ++ emit a configure event without the "maximized" state. ++ ++ If the surface is in a fullscreen state, this request has no direct ++ effect. It may alter the state the surface is returned to when ++ unmaximized unless overridden by the compositor. ++ ++ ++ ++ ++ ++ Make the surface fullscreen. ++ ++ After requesting that the surface should be fullscreened, the ++ compositor will respond by emitting a configure event. Whether the ++ client is actually put into a fullscreen state is subject to compositor ++ policies. The client must also acknowledge the configure when ++ committing the new content (see ack_configure). ++ ++ The output passed by the request indicates the client's preference as ++ to which display it should be set fullscreen on. If this value is NULL, ++ it's up to the compositor to choose which display will be used to map ++ this surface. ++ ++ If the surface doesn't cover the whole output, the compositor will ++ position the surface in the center of the output and compensate with ++ with border fill covering the rest of the output. The content of the ++ border fill is undefined, but should be assumed to be in some way that ++ attempts to blend into the surrounding area (e.g. solid black). ++ ++ If the fullscreened surface is not opaque, the compositor must make ++ sure that other screen content not part of the same surface tree (made ++ up of subsurfaces, popups or similarly coupled surfaces) are not ++ visible below the fullscreened surface. ++ ++ ++ ++ ++ ++ ++ Make the surface no longer fullscreen. ++ ++ After requesting that the surface should be unfullscreened, the ++ compositor will respond by emitting a configure event. ++ Whether this actually removes the fullscreen state of the client is ++ subject to compositor policies. ++ ++ Making a surface unfullscreen sets states for the surface based on the following: ++ * the state(s) it may have had before becoming fullscreen ++ * any state(s) decided by the compositor ++ * any state(s) requested by the client while the surface was fullscreen ++ ++ The compositor may include the previous window geometry dimensions in ++ the configure event, if applicable. ++ ++ The client must also acknowledge the configure when committing the new ++ content (see ack_configure). ++ ++ ++ ++ ++ ++ Request that the compositor minimize your surface. There is no ++ way to know if the surface is currently minimized, nor is there ++ any way to unset minimization on this surface. ++ ++ If you are looking to throttle redrawing when minimized, please ++ instead use the wl_surface.frame event for this, as this will ++ also work with live previews on windows in Alt-Tab, Expose or ++ similar compositor features. ++ ++ ++ ++ ++ ++ This configure event asks the client to resize its toplevel surface or ++ to change its state. The configured state should not be applied ++ immediately. See xdg_surface.configure for details. ++ ++ The width and height arguments specify a hint to the window ++ about how its surface should be resized in window geometry ++ coordinates. See set_window_geometry. ++ ++ If the width or height arguments are zero, it means the client ++ should decide its own window dimension. This may happen when the ++ compositor needs to configure the state of the surface but doesn't ++ have any information about any previous or expected dimension. ++ ++ The states listed in the event specify how the width/height ++ arguments should be interpreted, and possibly how it should be ++ drawn. ++ ++ Clients must send an ack_configure in response to this event. See ++ xdg_surface.configure and xdg_surface.ack_configure for details. ++ ++ ++ ++ ++ ++ ++ ++ ++ The close event is sent by the compositor when the user ++ wants the surface to be closed. This should be equivalent to ++ the user clicking the close button in client-side decorations, ++ if your application has any. ++ ++ This is only a request that the user intends to close the ++ window. The client may choose to ignore this request, or show ++ a dialog to ask the user to save their data, etc. ++ ++ ++ ++ ++ ++ ++ A popup surface is a short-lived, temporary surface. It can be used to ++ implement for example menus, popovers, tooltips and other similar user ++ interface concepts. ++ ++ A popup can be made to take an explicit grab. See xdg_popup.grab for ++ details. ++ ++ When the popup is dismissed, a popup_done event will be sent out, and at ++ the same time the surface will be unmapped. See the xdg_popup.popup_done ++ event for details. ++ ++ Explicitly destroying the xdg_popup object will also dismiss the popup and ++ unmap the surface. Clients that want to dismiss the popup when another ++ surface of their own is clicked should dismiss the popup using the destroy ++ request. ++ ++ A newly created xdg_popup will be stacked on top of all previously created ++ xdg_popup surfaces associated with the same xdg_toplevel. ++ ++ The parent of an xdg_popup must be mapped (see the xdg_surface ++ description) before the xdg_popup itself. ++ ++ The client must call wl_surface.commit on the corresponding wl_surface ++ for the xdg_popup state to take effect. ++ ++ ++ ++ ++ ++ ++ ++ ++ This destroys the popup. Explicitly destroying the xdg_popup ++ object will also dismiss the popup, and unmap the surface. ++ ++ If this xdg_popup is not the "topmost" popup, a protocol error ++ will be sent. ++ ++ ++ ++ ++ ++ This request makes the created popup take an explicit grab. An explicit ++ grab will be dismissed when the user dismisses the popup, or when the ++ client destroys the xdg_popup. This can be done by the user clicking ++ outside the surface, using the keyboard, or even locking the screen ++ through closing the lid or a timeout. ++ ++ If the compositor denies the grab, the popup will be immediately ++ dismissed. ++ ++ This request must be used in response to some sort of user action like a ++ button press, key press, or touch down event. The serial number of the ++ event should be passed as 'serial'. ++ ++ The parent of a grabbing popup must either be an xdg_toplevel surface or ++ another xdg_popup with an explicit grab. If the parent is another ++ xdg_popup it means that the popups are nested, with this popup now being ++ the topmost popup. ++ ++ Nested popups must be destroyed in the reverse order they were created ++ in, e.g. the only popup you are allowed to destroy at all times is the ++ topmost one. ++ ++ When compositors choose to dismiss a popup, they may dismiss every ++ nested grabbing popup as well. When a compositor dismisses popups, it ++ will follow the same dismissing order as required from the client. ++ ++ The parent of a grabbing popup must either be another xdg_popup with an ++ active explicit grab, or an xdg_popup or xdg_toplevel, if there are no ++ explicit grabs already taken. ++ ++ If the topmost grabbing popup is destroyed, the grab will be returned to ++ the parent of the popup, if that parent previously had an explicit grab. ++ ++ If the parent is a grabbing popup which has already been dismissed, this ++ popup will be immediately dismissed. If the parent is a popup that did ++ not take an explicit grab, an error will be raised. ++ ++ During a popup grab, the client owning the grab will receive pointer ++ and touch events for all their surfaces as normal (similar to an ++ "owner-events" grab in X11 parlance), while the top most grabbing popup ++ will always have keyboard focus. ++ ++ ++ ++ ++ ++ ++ ++ This event asks the popup surface to configure itself given the ++ configuration. The configured state should not be applied immediately. ++ See xdg_surface.configure for details. ++ ++ The x and y arguments represent the position the popup was placed at ++ given the xdg_positioner rule, relative to the upper left corner of the ++ window geometry of the parent surface. ++ ++ For version 2 or older, the configure event for an xdg_popup is only ++ ever sent once for the initial configuration. Starting with version 3, ++ it may be sent again if the popup is setup with an xdg_positioner with ++ set_reactive requested, or in response to xdg_popup.reposition requests. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The popup_done event is sent out when a popup is dismissed by the ++ compositor. The client should destroy the xdg_popup object at this ++ point. ++ ++ ++ ++ ++ ++ ++ ++ Reposition an already-mapped popup. The popup will be placed given the ++ details in the passed xdg_positioner object, and a ++ xdg_popup.repositioned followed by xdg_popup.configure and ++ xdg_surface.configure will be emitted in response. Any parameters set ++ by the previous positioner will be discarded. ++ ++ The passed token will be sent in the corresponding ++ xdg_popup.repositioned event. The new popup position will not take ++ effect until the corresponding configure event is acknowledged by the ++ client. See xdg_popup.repositioned for details. The token itself is ++ opaque, and has no other special meaning. ++ ++ If multiple reposition requests are sent, the compositor may skip all ++ but the last one. ++ ++ If the popup is repositioned in response to a configure event for its ++ parent, the client should send an xdg_positioner.set_parent_configure ++ and possibly an xdg_positioner.set_parent_size request to allow the ++ compositor to properly constrain the popup. ++ ++ If the popup is repositioned together with a parent that is being ++ resized, but not in response to a configure event, the client should ++ send an xdg_positioner.set_parent_size request. ++ ++ ++ ++ ++ ++ ++ ++ The repositioned event is sent as part of a popup configuration ++ sequence, together with xdg_popup.configure and lastly ++ xdg_surface.configure to notify the completion of a reposition request. ++ ++ The repositioned event is to notify about the completion of a ++ xdg_popup.reposition request. The token argument is the token passed ++ in the xdg_popup.reposition request. ++ ++ Immediately after this event is emitted, xdg_popup.configure and ++ xdg_surface.configure will be sent with the updated size and position, ++ as well as a new configure serial. ++ ++ The client should optionally update the content of the popup, but must ++ acknowledge the new popup configuration for the new position to take ++ effect. See xdg_surface.ack_configure for details. ++ ++ ++ ++ ++ ++ +diff --git a/freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v5.xml b/freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v5.xml +deleted file mode 100644 +index ef0180d..0000000 +--- a/freedesktop.org/unstable/xdg-shell/xdg-shell-unstable-v5.xml ++++ /dev/null +@@ -1,623 +0,0 @@ +- +- +- +- +- Copyright © 2008-2013 Kristian Høgsberg +- Copyright © 2013 Rafael Antognolli +- Copyright © 2013 Jasper St. Pierre +- Copyright © 2010-2013 Intel Corporation +- +- Permission is hereby granted, free of charge, to any person obtaining a +- copy of this software and associated documentation files (the "Software"), +- to deal in the Software without restriction, including without limitation +- the rights to use, copy, modify, merge, publish, distribute, sublicense, +- and/or sell copies of the Software, and to permit persons to whom the +- Software is furnished to do so, subject to the following conditions: +- +- The above copyright notice and this permission notice (including the next +- paragraph) shall be included in all copies or substantial portions of the +- Software. +- +- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +- DEALINGS IN THE SOFTWARE. +- +- +- +- +- xdg_shell allows clients to turn a wl_surface into a "real window" +- which can be dragged, resized, stacked, and moved around by the +- user. Everything about this interface is suited towards traditional +- desktop environments. +- +- +- +- +- The 'current' member of this enum gives the version of the +- protocol. Implementations can compare this to the version +- they implement using static_assert to ensure the protocol and +- implementation versions match. +- +- +- +- +- +- +- +- +- +- +- +- +- +- Destroy this xdg_shell object. +- +- Destroying a bound xdg_shell object while there are surfaces +- still alive created by this xdg_shell object instance is illegal +- and will result in a protocol error. +- +- +- +- +- +- Negotiate the unstable version of the interface. This +- mechanism is in place to ensure client and server agree on the +- unstable versions of the protocol that they speak or exit +- cleanly if they don't agree. This request will go away once +- the xdg-shell protocol is stable. +- +- +- +- +- +- +- This creates an xdg_surface for the given surface and gives it the +- xdg_surface role. A wl_surface can only be given an xdg_surface role +- once. If get_xdg_surface is called with a wl_surface that already has +- an active xdg_surface associated with it, or if it had any other role, +- an error is raised. +- +- See the documentation of xdg_surface for more details about what an +- xdg_surface is and how it is used. +- +- +- +- +- +- +- +- This creates an xdg_popup for the given surface and gives it the +- xdg_popup role. A wl_surface can only be given an xdg_popup role +- once. If get_xdg_popup is called with a wl_surface that already has +- an active xdg_popup associated with it, or if it had any other role, +- an error is raised. +- +- This request must be used in response to some sort of user action +- like a button press, key press, or touch down event. +- +- See the documentation of xdg_popup for more details about what an +- xdg_popup is and how it is used. +- +- +- +- +- +- +- +- +- +- +- +- +- The ping event asks the client if it's still alive. Pass the +- serial specified in the event back to the compositor by sending +- a "pong" request back with the specified serial. +- +- Compositors can use this to determine if the client is still +- alive. It's unspecified what will happen if the client doesn't +- respond to the ping request, or in what timeframe. Clients should +- try to respond in a reasonable amount of time. +- +- A compositor is free to ping in any way it wants, but a client must +- always respond to any xdg_shell object it created. +- +- +- +- +- +- +- A client must respond to a ping event with a pong request or +- the client may be deemed unresponsive. +- +- +- +- +- +- +- +- An interface that may be implemented by a wl_surface, for +- implementations that provide a desktop-style user interface. +- +- It provides requests to treat surfaces like windows, allowing to set +- properties like maximized, fullscreen, minimized, and to move and resize +- them, and associate metadata like title and app id. +- +- The client must call wl_surface.commit on the corresponding wl_surface +- for the xdg_surface state to take effect. Prior to committing the new +- state, it can set up initial configuration, such as maximizing or setting +- a window geometry. +- +- Even without attaching a buffer the compositor must respond to initial +- committed configuration, for instance sending a configure event with +- expected window geometry if the client maximized its surface during +- initialization. +- +- For a surface to be mapped by the compositor the client must have +- committed both an xdg_surface state and a buffer. +- +- +- +- +- Unmap and destroy the window. The window will be effectively +- hidden from the user's point of view, and all state like +- maximization, fullscreen, and so on, will be lost. +- +- +- +- +- +- Set the "parent" of this surface. This window should be stacked +- above a parent. The parent surface must be mapped as long as this +- surface is mapped. +- +- Parent windows should be set on dialogs, toolboxes, or other +- "auxiliary" surfaces, so that the parent is raised when the dialog +- is raised. +- +- +- +- +- +- +- Set a short title for the surface. +- +- This string may be used to identify the surface in a task bar, +- window list, or other user interface elements provided by the +- compositor. +- +- The string must be encoded in UTF-8. +- +- +- +- +- +- +- Set an application identifier for the surface. +- +- The app ID identifies the general class of applications to which +- the surface belongs. The compositor can use this to group multiple +- surfaces together, or to determine how to launch a new application. +- +- For D-Bus activatable applications, the app ID is used as the D-Bus +- service name. +- +- The compositor shell will try to group application surfaces together +- by their app ID. As a best practice, it is suggested to select app +- ID's that match the basename of the application's .desktop file. +- For example, "org.freedesktop.FooViewer" where the .desktop file is +- "org.freedesktop.FooViewer.desktop". +- +- See the desktop-entry specification [0] for more details on +- application identifiers and how they relate to well-known D-Bus +- names and .desktop files. +- +- [0] http://standards.freedesktop.org/desktop-entry-spec/ +- +- +- +- +- +- +- Clients implementing client-side decorations might want to show +- a context menu when right-clicking on the decorations, giving the +- user a menu that they can use to maximize or minimize the window. +- +- This request asks the compositor to pop up such a window menu at +- the given position, relative to the local surface coordinates of +- the parent surface. There are no guarantees as to what menu items +- the window menu contains. +- +- This request must be used in response to some sort of user action +- like a button press, key press, or touch down event. +- +- +- +- +- +- +- +- +- +- Start an interactive, user-driven move of the surface. +- +- This request must be used in response to some sort of user action +- like a button press, key press, or touch down event. The passed +- serial is used to determine the type of interactive move (touch, +- pointer, etc). +- +- The server may ignore move requests depending on the state of +- the surface (e.g. fullscreen or maximized), or if the passed serial +- is no longer valid. +- +- If triggered, the surface will lose the focus of the device +- (wl_pointer, wl_touch, etc) used for the move. It is up to the +- compositor to visually indicate that the move is taking place, such as +- updating a pointer cursor, during the move. There is no guarantee +- that the device focus will return when the move is completed. +- +- +- +- +- +- +- +- These values are used to indicate which edge of a surface +- is being dragged in a resize operation. +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- Start a user-driven, interactive resize of the surface. +- +- This request must be used in response to some sort of user action +- like a button press, key press, or touch down event. The passed +- serial is used to determine the type of interactive resize (touch, +- pointer, etc). +- +- The server may ignore resize requests depending on the state of +- the surface (e.g. fullscreen or maximized). +- +- If triggered, the client will receive configure events with the +- "resize" state enum value and the expected sizes. See the "resize" +- enum value for more details about what is required. The client +- must also acknowledge configure events using "ack_configure". After +- the resize is completed, the client will receive another "configure" +- event without the resize state. +- +- If triggered, the surface also will lose the focus of the device +- (wl_pointer, wl_touch, etc) used for the resize. It is up to the +- compositor to visually indicate that the resize is taking place, +- such as updating a pointer cursor, during the resize. There is no +- guarantee that the device focus will return when the resize is +- completed. +- +- The edges parameter specifies how the surface should be resized, +- and is one of the values of the resize_edge enum. The compositor +- may use this information to update the surface position for +- example when dragging the top left corner. The compositor may also +- use this information to adapt its behavior, e.g. choose an +- appropriate cursor image. +- +- +- +- +- +- +- +- +- The different state values used on the surface. This is designed for +- state values like maximized, fullscreen. It is paired with the +- configure event to ensure that both the client and the compositor +- setting the state can be synchronized. +- +- States set in this way are double-buffered. They will get applied on +- the next commit. +- +- Desktop environments may extend this enum by taking up a range of +- values and documenting the range they chose in this description. +- They are not required to document the values for the range that they +- chose. Ideally, any good extensions from a desktop environment should +- make its way into standardization into this enum. +- +- The current reserved ranges are: +- +- 0x0000 - 0x0FFF: xdg-shell core values, documented below. +- 0x1000 - 0x1FFF: GNOME +- 0x2000 - 0x2FFF: EFL +- +- +- +- The surface is maximized. The window geometry specified in the configure +- event must be obeyed by the client. +- +- +- +- +- The surface is fullscreen. The window geometry specified in the configure +- event must be obeyed by the client. +- +- +- +- +- The surface is being resized. The window geometry specified in the +- configure event is a maximum; the client cannot resize beyond it. +- Clients that have aspect ratio or cell sizing configuration can use +- a smaller size, however. +- +- +- +- +- Client window decorations should be painted as if the window is +- active. Do not assume this means that the window actually has +- keyboard or pointer focus. +- +- +- +- +- +- +- The configure event asks the client to resize its surface or to +- change its state. +- +- The width and height arguments specify a hint to the window +- about how its surface should be resized in window geometry +- coordinates. See set_window_geometry. +- +- If the width or height arguments are zero, it means the client +- should decide its own window dimension. This may happen when the +- compositor need to configure the state of the surface but doesn't +- have any information about any previous or expected dimension. +- +- The states listed in the event specify how the width/height +- arguments should be interpreted, and possibly how it should be +- drawn. +- +- Clients should arrange their surface for the new size and +- states, and then send a ack_configure request with the serial +- sent in this configure event at some point before committing +- the new surface. +- +- If the client receives multiple configure events before it +- can respond to one, it is free to discard all but the last +- event it received. +- +- +- +- +- +- +- +- +- +- When a configure event is received, if a client commits the +- surface in response to the configure event, then the client +- must make an ack_configure request sometime before the commit +- request, passing along the serial of the configure event. +- +- For instance, the compositor might use this information to move +- a surface to the top left only when the client has drawn itself +- for the maximized or fullscreen state. +- +- If the client receives multiple configure events before it +- can respond to one, it only has to ack the last configure event. +- +- A client is not required to commit immediately after sending +- an ack_configure request - it may even ack_configure several times +- before its next surface commit. +- +- The compositor expects that the most recently received +- ack_configure request at the time of a commit indicates which +- configure event the client is responding to. +- +- +- +- +- +- +- The window geometry of a window is its "visible bounds" from the +- user's perspective. Client-side decorations often have invisible +- portions like drop-shadows which should be ignored for the +- purposes of aligning, placing and constraining windows. +- +- The window geometry is double buffered, and will be applied at the +- time wl_surface.commit of the corresponding wl_surface is called. +- +- Once the window geometry of the surface is set once, it is not +- possible to unset it, and it will remain the same until +- set_window_geometry is called again, even if a new subsurface or +- buffer is attached. +- +- If never set, the value is the full bounds of the surface, +- including any subsurfaces. This updates dynamically on every +- commit. This unset mode is meant for extremely simple clients. +- +- If responding to a configure event, the window geometry in here +- must respect the sizing negotiations specified by the states in +- the configure event. +- +- The arguments are given in the surface local coordinate space of +- the wl_surface associated with this xdg_surface. +- +- The width and height must be greater than zero. +- +- +- +- +- +- +- +- +- +- Maximize the surface. +- +- After requesting that the surface should be maximized, the compositor +- will respond by emitting a configure event with the "maximized" state +- and the required window geometry. The client should then update its +- content, drawing it in a maximized state, i.e. without shadow or other +- decoration outside of the window geometry. The client must also +- acknowledge the configure when committing the new content (see +- ack_configure). +- +- It is up to the compositor to decide how and where to maximize the +- surface, for example which output and what region of the screen should +- be used. +- +- If the surface was already maximized, the compositor will still emit +- a configure event with the "maximized" state. +- +- +- +- +- +- Unmaximize the surface. +- +- After requesting that the surface should be unmaximized, the compositor +- will respond by emitting a configure event without the "maximized" +- state. If available, the compositor will include the window geometry +- dimensions the window had prior to being maximized in the configure +- request. The client must then update its content, drawing it in a +- regular state, i.e. potentially with shadow, etc. The client must also +- acknowledge the configure when committing the new content (see +- ack_configure). +- +- It is up to the compositor to position the surface after it was +- unmaximized; usually the position the surface had before maximizing, if +- applicable. +- +- If the surface was already not maximized, the compositor will still +- emit a configure event without the "maximized" state. +- +- +- +- +- +- Make the surface fullscreen. +- +- You can specify an output that you would prefer to be fullscreen. +- If this value is NULL, it's up to the compositor to choose which +- display will be used to map this surface. +- +- If the surface doesn't cover the whole output, the compositor will +- position the surface in the center of the output and compensate with +- black borders filling the rest of the output. +- +- +- +- +- +- +- +- Request that the compositor minimize your surface. There is no +- way to know if the surface is currently minimized, nor is there +- any way to unset minimization on this surface. +- +- If you are looking to throttle redrawing when minimized, please +- instead use the wl_surface.frame event for this, as this will +- also work with live previews on windows in Alt-Tab, Expose or +- similar compositor features. +- +- +- +- +- +- The close event is sent by the compositor when the user +- wants the surface to be closed. This should be equivalent to +- the user clicking the close button in client-side decorations, +- if your application has any... +- +- This is only a request that the user intends to close your +- window. The client may choose to ignore this request, or show +- a dialog to ask the user to save their data... +- +- +- +- +- +- +- A popup surface is a short-lived, temporary surface that can be +- used to implement menus. It takes an explicit grab on the surface +- that will be dismissed when the user dismisses the popup. This can +- be done by the user clicking outside the surface, using the keyboard, +- or even locking the screen through closing the lid or a timeout. +- +- When the popup is dismissed, a popup_done event will be sent out, +- and at the same time the surface will be unmapped. The xdg_popup +- object is now inert and cannot be reactivated, so clients should +- destroy it. Explicitly destroying the xdg_popup object will also +- dismiss the popup and unmap the surface. +- +- Clients will receive events for all their surfaces during this +- grab (which is an "owner-events" grab in X11 parlance). This is +- done so that users can navigate through submenus and other +- "nested" popup windows without having to dismiss the topmost +- popup. +- +- Clients that want to dismiss the popup when another surface of +- their own is clicked should dismiss the popup using the destroy +- request. +- +- The parent surface must have either an xdg_surface or xdg_popup +- role. +- +- Specifying an xdg_popup for the parent means that the popups are +- nested, with this popup now being the topmost popup. Nested +- popups must be destroyed in the reverse order they were created +- in, e.g. the only popup you are allowed to destroy at all times +- is the topmost one. +- +- If there is an existing popup when creating a new popup, the +- parent must be the current topmost popup. +- +- A parent surface must be mapped before the new popup is mapped. +- +- When compositors choose to dismiss a popup, they will likely +- dismiss every nested popup as well. When a compositor dismisses +- popups, it will follow the same dismissing order as required +- from the client. +- +- The x and y arguments passed when creating the popup object specify +- where the top left of the popup should be placed, relative to the +- local surface coordinates of the parent surface. See +- xdg_shell.get_xdg_popup. +- +- The client must call wl_surface.commit on the corresponding wl_surface +- for the xdg_popup state to take effect. +- +- For a surface to be mapped by the compositor the client must have +- committed both the xdg_popup state and a buffer. +- +- +- +- +- This destroys the popup. Explicitly destroying the xdg_popup +- object will also dismiss the popup, and unmap the surface. +- +- If this xdg_popup is not the "topmost" popup, a protocol error +- will be sent. +- +- +- +- +- +- The popup_done event is sent out when a popup is dismissed by the +- compositor. The client should destroy the xdg_popup object at this +- point. +- +- +- +- +- +-- +2.20.1 + diff --git a/lineage/patches/build/frameworks/av/0001-libcameraservice-Use-listByInterface.patch b/lineage/patches/build/frameworks/av/0001-libcameraservice-Use-listByInterface.patch new file mode 100644 index 0000000..b8a7085 --- /dev/null +++ b/lineage/patches/build/frameworks/av/0001-libcameraservice-Use-listByInterface.patch @@ -0,0 +1,51 @@ +From 8e5a7ef2f2af5d1e53650e5243cce7b989f0c2c9 Mon Sep 17 00:00:00 2001 +From: Erfan Abdi +Date: Thu, 20 May 2021 22:35:53 +0430 +Subject: [PATCH] libcameraservice: Use listByInterface + +--- + .../common/CameraProviderManager.cpp | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp +index fdb5657500..93bd8156f2 100644 +--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp ++++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp +@@ -29,7 +29,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -62,13 +62,22 @@ CameraProviderManager::~CameraProviderManager() { + hardware::hidl_vec + CameraProviderManager::HardwareServiceInteractionProxy::listServices() { + hardware::hidl_vec ret; +- auto manager = hardware::defaultServiceManager1_2(); +- if (manager != nullptr) { +- manager->listManifestByInterface(provider::V2_4::ICameraProvider::descriptor, ++ auto manager = hardware::defaultServiceManager1_1(); ++ auto manager_host = hardware::defaultServiceManager1_1(true); ++ if (manager_host != nullptr) { ++ manager_host->listByInterface(provider::V2_4::ICameraProvider::descriptor, + [&ret](const hardware::hidl_vec ®istered) { + ret = registered; + }); + } ++ if (ret.size() == 0) { ++ if (manager != nullptr) { ++ manager->listByInterface(provider::V2_4::ICameraProvider::descriptor, ++ [&ret](const hardware::hidl_vec ®istered) { ++ ret = registered; ++ }); ++ } ++ } + return ret; + } + +-- +2.20.1 + diff --git a/lineage/patches/build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch b/lineage/patches/build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch new file mode 100644 index 0000000..8f22538 --- /dev/null +++ b/lineage/patches/build/soong/0001-anbox-do-not-fail-on-VNDK-ABI-mismatch.patch @@ -0,0 +1,29 @@ +From 112f1622b85091bf339e4549456ebac35fe0f95b Mon Sep 17 00:00:00 2001 +From: Erfan Abdi +Date: Sun, 2 May 2021 02:06:01 +0800 +Subject: [PATCH] (anbox) do not fail on VNDK ABI mismatch + +Change-Id: I439748c1e538aa5414a66799c6720f1775d34d04 +--- + cc/builder.go | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/cc/builder.go b/cc/builder.go +index a9ee4e92..edad15dd 100644 +--- a/cc/builder.go ++++ b/cc/builder.go +@@ -740,9 +740,8 @@ func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD + createReferenceDumpFlags := "" + + localAbiCheckAllowFlags := append([]string(nil), abiCheckAllowFlags...) +- if exportedHeaderFlags == "" { +- localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only") +- } ++ localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-advice-only") ++ + if isLlndk { + localAbiCheckAllowFlags = append(localAbiCheckAllowFlags, "-consider-opaque-types-different") + createReferenceDumpFlags = "--llndk" +-- +2.20.1 + diff --git a/roms.lst b/roms.lst new file mode 100644 index 0000000..439af55 --- /dev/null +++ b/roms.lst @@ -0,0 +1,3 @@ +bliss +lineage + diff --git a/vendorsetup.sh b/vendorsetup.sh new file mode 100644 index 0000000..b793820 --- /dev/null +++ b/vendorsetup.sh @@ -0,0 +1,51 @@ +rompath=$(pwd) +vendor_path="vendor/anbox" + +function apply-anbox-patches +{ + + ${vendor_path}/autopatch.sh + +} + +function install-anbox +{ + + ${vendor_path}/anbox-halium/scripts/install.sh + +} + +function run-anbox +{ + + ${vendor_path}/anbox-halium/scripts/run-container.sh + +} + +function stop-anbox +{ + + ${vendor_path}/anbox-halium/scripts/stop-container.sh + +} + +function check-anbox-kernel-config +{ + + ${vendor_path}/anbox-halium/scripts/check-kernel-config.sh + +} + +function anbox-net +{ + + ${vendor_path}/anbox-halium/scripts/anbox-net.sh + +} + +function anbox-generate-props +{ + + ${vendor_path}/anbox-halium/scripts/generate-props.sh + +} From 5d910fb15101f76e0b845a4a6f317b4ebd8f89f1 Mon Sep 17 00:00:00 2001 From: Jon West Date: Sat, 31 Jul 2021 18:28:17 -0400 Subject: [PATCH 02/13] Remove unneeded patches from Bliss patchset --- .../0007-core-Add-support-for-MicroG.patch | 92 ------------------- ...add-a-permission-group-for-signature.patch | 56 ----------- 2 files changed, 148 deletions(-) delete mode 100644 bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch delete mode 100644 bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch diff --git a/bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch b/bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch deleted file mode 100644 index 09a1e44..0000000 --- a/bliss/patches/frameworks/base/0007-core-Add-support-for-MicroG.patch +++ /dev/null @@ -1,92 +0,0 @@ -From a671d56cf632a52fbb466f3672d0f93b6e3b40de Mon Sep 17 00:00:00 2001 -From: gudenau -Date: Tue, 25 Sep 2018 09:44:26 +0200 -Subject: [PATCH 1/2] core: Add support for MicroG - --fake signatures, enabled per app by dynamic permission - -Change-Id: I84fc7e5c606f4b57012d948a4cc6cb521db6b03e ---- - core/res/AndroidManifest.xml | 7 ++++++ - core/res/res/values/cm_strings.xml | 6 +++++ - .../server/pm/PackageManagerService.java | 24 ++++++++++++++++--- - 3 files changed, 34 insertions(+), 3 deletions(-) - -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index 316496d28a9..29450170b6c 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -2688,6 +2688,13 @@ - android:label="@string/permlab_fakePackageSignature" - android:description="@string/permdesc_fakePackageSignature" /> - -+ -+ -+ - -diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml -index 972ed01636d..9c55e4428b4 100644 ---- a/core/res/res/values/cm_strings.xml -+++ b/core/res/res/values/cm_strings.xml -@@ -29,4 +29,10 @@ - - Bluetooth will stay on during airplane mode - -+ -+ Spoof package signature -+ -+ Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only! -+ - -diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java -index 68b6b51c356..c363e0b45e7 100644 ---- a/services/core/java/com/android/server/pm/PackageManagerService.java -+++ b/services/core/java/com/android/server/pm/PackageManagerService.java -@@ -4208,9 +4208,9 @@ public class PackageManagerService extends IPackageManager.Stub - final Set permissions = ArrayUtils.isEmpty(p.requestedPermissions) - ? Collections.emptySet() : permissionsState.getPermissions(userId); - -- PackageInfo packageInfo = mayFakeSignature(p, PackageParser -- .generatePackageInfo(p, gids, flags, ps.firstInstallTime, -- ps.lastUpdateTime, permissions, state, userId), permissions); -+ PackageInfo packageInfo = mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags, -+ ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId), -+ permissions); - - if (packageInfo == null) { - return null; -@@ -4266,6 +4266,24 @@ public class PackageManagerService extends IPackageManager.Stub - return pi; - } - -+ private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi, -+ Set permissions) { -+ try { -+ if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") -+ && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1 -+ && p.mAppMetaData != null) { -+ String sig = p.mAppMetaData.getString("fake-signature"); -+ if (sig != null) { -+ pi.signatures = new Signature[] {new Signature(sig)}; -+ } -+ } -+ } catch (Throwable t) { -+ // We should never die because of any failures, this is system code! -+ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t); -+ } -+ return pi; -+ } -+ - @Override - public void checkPackageStartable(String packageName, int userId) { - final int callingUid = Binder.getCallingUid(); --- -2.20.1 - diff --git a/bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch b/bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch deleted file mode 100644 index 7763970..0000000 --- a/bliss/patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 808ce78e3f004671e5e0e30515055f2f80ca0cab Mon Sep 17 00:00:00 2001 -From: Vachounet -Date: Wed, 12 Feb 2020 11:34:33 +0100 -Subject: [PATCH 2/2] AndroidManifest: add a permission group for signature - spoofing - -Needed by PackageInstaller while checking for modern permission group - -Change-Id: Ibb402960dcde6d21106d1481ca7c3cd314fd2ac1 ---- - core/res/AndroidManifest.xml | 8 ++++++++ - core/res/res/values/cm_strings.xml | 7 +++++++ - 2 files changed, 15 insertions(+) - -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index 29450170b6c..044eeed257a 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -2688,9 +2688,17 @@ - android:label="@string/permlab_fakePackageSignature" - android:description="@string/permdesc_fakePackageSignature" /> - -+ -+ -+ - - -diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml -index 9c55e4428b4..674583b3a0e 100644 ---- a/core/res/res/values/cm_strings.xml -+++ b/core/res/res/values/cm_strings.xml -@@ -34,5 +34,12 @@ - - Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only! -+ -+ Spoof package signature -+ -+ allow to spoof package signature -+ -+ Allow -+ <b>%1$s</b> to spoof package signature? - - --- -2.20.1 - From 4f140c240857c7d9942eb30252ab2fe52927b468 Mon Sep 17 00:00:00 2001 From: Jon West Date: Sat, 31 Jul 2021 18:51:44 -0400 Subject: [PATCH 03/13] Add manifest generation this will dynamically generate the removes files and setup the local_manifest folder for the user. . build/envsetup.sh anbox-generate-manifest --- .gitignore | 1 + manifest_scripts/generate-remove-project.sh | 95 +++++++++++++++++++++ manifest_scripts/manifests/00-remotes.xml | 7 ++ manifest_scripts/manifests/02-waydroid.xml | 29 +++++++ manifest_scripts/remove.lst | 5 ++ vendorsetup.sh | 7 ++ 6 files changed, 144 insertions(+) create mode 100755 manifest_scripts/generate-remove-project.sh create mode 100644 manifest_scripts/manifests/00-remotes.xml create mode 100644 manifest_scripts/manifests/02-waydroid.xml create mode 100644 manifest_scripts/remove.lst diff --git a/.gitignore b/.gitignore index 7b8c45a..10f43e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ anbox-halium/ +tmp/ diff --git a/manifest_scripts/generate-remove-project.sh b/manifest_scripts/generate-remove-project.sh new file mode 100755 index 0000000..0f97e60 --- /dev/null +++ b/manifest_scripts/generate-remove-project.sh @@ -0,0 +1,95 @@ +# +# Copyright (C) 2021 The BlissLabs +# +# 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. +# + +rompath="$PWD" +vendor_path="anbox" +temp_path="$rompath/vendor/$vendor_path/tmp/" +config_type="$1" + +#setup colors +red=`tput setaf 1` +green=`tput setaf 2` +yellow=`tput setaf 3` +blue=`tput setaf 4` +purple=`tput setaf 5` +teal=`tput setaf 6` +light=`tput setaf 7` +dark=`tput setaf 8` +ltred=`tput setaf 9` +ltgreen=`tput setaf 10` +ltyellow=`tput setaf 11` +ltblue=`tput setaf 12` +ltpurple=`tput setaf 13` +CL_CYN=`tput setaf 12` +CL_RST=`tput sgr0` +reset=`tput sgr0` + +addRemove() { + #~ echo "Adding $1" + echo -e "\t$1" >> "$temp_path/01-remove.xml" +} + +readFile() { + echo -e ${reset}""${reset} + echo -e ${green}"00-remove.xml generation starting..."${reset} + echo -e ${reset}""${reset} + + while IFS= read -r rpitem; do + if grep -RlZ "$rpitem" $rompath/.repo/manifests/; then + echo -e ${yellow}" ROM already includes: $rpitem"${reset} + else + prefix="" + item=${rpitem#"$prefix"} + item=${item%"$suffix"} + if grep -RlZ "$item" $rompath/.repo/manifests/; then + addRemove "$rpitem" + fi + fi + done < $rompath/vendor/$vendor_path/manifest_scripts/remove.lst +} + + +if [ -d $temp_path ]; then + echo -e ${reset}""${reset} + echo -e ${teal}"Temp Path Already Created, cleaning up"${reset} + echo -e ${reset}""${reset} + rm -rf "$temp_path/01-remove.xml" +else + mkdir -p "$temp_path" +fi + +if [ -d $rompath/.repo/local_manifests/ ]; then + echo -e ${reset}""${reset} + echo -e ${teal}"local_manifests Path Already Created"${reset} +else + mkdir -p "$rompath/.repo/local_manifests/" +fi + +echo -e '' > "$temp_path/01-remove.xml" +echo -e '' >> "$temp_path/01-remove.xml" + +readFile + +echo -e '' >> "$temp_path/01-remove.xml" + +cp -r "$temp_path/01-remove.xml" $rompath/.repo/local_manifests/ + +cp -r $rompath/vendor/$vendor_path/manifest_scripts/manifests/*.xml $rompath/.repo/local_manifests + +echo -e ${reset}""${reset} +echo -e ${green}"manifest generation complete. Files have been copied to $rompath/.repo/local_manifests"${reset} +echo -e ${reset}""${reset} diff --git a/manifest_scripts/manifests/00-remotes.xml b/manifest_scripts/manifests/00-remotes.xml new file mode 100644 index 0000000..edad5be --- /dev/null +++ b/manifest_scripts/manifests/00-remotes.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/manifest_scripts/manifests/02-waydroid.xml b/manifest_scripts/manifests/02-waydroid.xml new file mode 100644 index 0000000..0fb77b5 --- /dev/null +++ b/manifest_scripts/manifests/02-waydroid.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/manifest_scripts/remove.lst b/manifest_scripts/remove.lst new file mode 100644 index 0000000..6a78e6e --- /dev/null +++ b/manifest_scripts/remove.lst @@ -0,0 +1,5 @@ + + + + + diff --git a/vendorsetup.sh b/vendorsetup.sh index b793820..1b516a2 100644 --- a/vendorsetup.sh +++ b/vendorsetup.sh @@ -49,3 +49,10 @@ function anbox-generate-props ${vendor_path}/anbox-halium/scripts/generate-props.sh } + +function anbox-generate-manifest +{ + + ${vendor_path}/manifest_scripts/generate-remove-project.sh + +} From 7c53eca517e9f6c9c7b76621f96c10fca43d9f96 Mon Sep 17 00:00:00 2001 From: Jon West Date: Sat, 31 Jul 2021 19:36:53 -0400 Subject: [PATCH 04/13] Add readme here --- README.md | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f625c0 --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +Anbox-halium +=========== + +Getting started +--------------- + +To get started with Android/LineageOS/BlissROM, you'll need to get +familiar with [Repo](https://source.android.com/source/using-repo.html) and [Version Control with Git](https://source.android.com/source/version-control.html). + + + +To initialize your local repository using the LineageOS trees, use a command like this: +``` +repo init -u git://github.com/LineageOS/android.git -b lineage-17.1 +``` +or... to initialize your local repository using the BlissROM trees, use a command like this: +``` +repo init -u https://github.com/BlissRoms/platform_manifest.git -b q +``` + +And do an initial sync: +``` +repo sync +``` + +Adding Anbox-halium +------------------- + +Clone in anbox vendor: +``` +git clone https://github.com/Anbox-halium/anbox-patches vendor/anbox +``` +Then we generate the manifest: +``` +. build/envsetup.sh +anbox-generate-manifest +``` +Then sync again: +``` +repo sync +``` +Then to apply anbox patches: +``` +apply-anbox-patches +``` + +How to build +--------------- + +Please see the [LineageOS Wiki](https://wiki.lineageos.org/) for building environment setup. + +To build anbox for LineageOS: +``` +. build/envsetup.sh +lunch lineage_anbox_arm64-userdebug +make systemimage -j$(nproc --all) +make vendorimage -j$(nproc --all) +``` +To build anbox for BlissROM: +``` +. build/envsetup.sh +lunch bliss_anbox_arm64-userdebug +make systemimage -j$(nproc --all) +make vendorimage -j$(nproc --all) +``` + +How to install +--------------- +Execute command blew: +``` +wget -O - https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/install.sh | bash +``` +Note: Run installer on the user you are willing to install anbox on + +Patching kernel +--------------- +Running anbox requires: +* Veth for networking +* Ashmem +* Specific binder nodes (anbox-binder anbox-hwbinder anbox-vndbinder) +Checkout defconfig kernel patcher [script](https://github.com/Anbox-halium/anbox-halium/blob/lineage-17.1/scripts/check-kernel-config.sh) for patching halium devices kernel. +``` +check-kernel-config.sh halium_device_defconfig -w +``` +On mainline devices it is highly recommanded to use needed drivers as module. (binder_linux and ashmem_linux) From 4123e63c75f9b61057a2ad1f841cd8545c21792e Mon Sep 17 00:00:00 2001 From: Jon West Date: Sat, 31 Jul 2021 19:37:57 -0400 Subject: [PATCH 05/13] Remove whitespace --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index 7f625c0..4ca84d0 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ Getting started To get started with Android/LineageOS/BlissROM, you'll need to get familiar with [Repo](https://source.android.com/source/using-repo.html) and [Version Control with Git](https://source.android.com/source/version-control.html). - - To initialize your local repository using the LineageOS trees, use a command like this: ``` repo init -u git://github.com/LineageOS/android.git -b lineage-17.1 @@ -17,15 +15,12 @@ or... to initialize your local repository using the BlissROM trees, use a comman ``` repo init -u https://github.com/BlissRoms/platform_manifest.git -b q ``` - And do an initial sync: ``` repo sync ``` - Adding Anbox-halium ------------------- - Clone in anbox vendor: ``` git clone https://github.com/Anbox-halium/anbox-patches vendor/anbox @@ -43,10 +38,8 @@ Then to apply anbox patches: ``` apply-anbox-patches ``` - How to build --------------- - Please see the [LineageOS Wiki](https://wiki.lineageos.org/) for building environment setup. To build anbox for LineageOS: From 13b6a0858a868e33a3ff1145d62e661c0b2e2d61 Mon Sep 17 00:00:00 2001 From: Jon West Date: Sat, 31 Jul 2021 19:49:48 -0400 Subject: [PATCH 06/13] Remove vendor/anbox/* from manifest --- manifest_scripts/manifests/02-waydroid.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifest_scripts/manifests/02-waydroid.xml b/manifest_scripts/manifests/02-waydroid.xml index 0fb77b5..3598ee4 100644 --- a/manifest_scripts/manifests/02-waydroid.xml +++ b/manifest_scripts/manifests/02-waydroid.xml @@ -8,8 +8,6 @@ - - From c7a42071c5b7e5d330ad9ccd7038fa9adac8ac92 Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Wed, 11 Aug 2021 08:08:22 +0430 Subject: [PATCH 07/13] sdk: Add waydroid service --- .../0001-sdk-Introduce-WayDroid-Service.patch | 1412 +++++++++++++++++ 1 file changed, 1412 insertions(+) create mode 100644 lineage-sdk/0001-sdk-Introduce-WayDroid-Service.patch diff --git a/lineage-sdk/0001-sdk-Introduce-WayDroid-Service.patch b/lineage-sdk/0001-sdk-Introduce-WayDroid-Service.patch new file mode 100644 index 0000000..9bbd934 --- /dev/null +++ b/lineage-sdk/0001-sdk-Introduce-WayDroid-Service.patch @@ -0,0 +1,1412 @@ +From fb42f3c5d213ae89066f14466e564e6f5be9ad20 Mon Sep 17 00:00:00 2001 +From: Erfan Abdi +Date: Fri, 30 Jul 2021 23:27:33 +0430 +Subject: [PATCH] sdk: Introduce WayDroid Service + +--- + Android.mk | 2 +- + api/lineage_current.txt | 57 +++ + .../platform/internal/WayDroidService.java | 442 ++++++++++++++++++ + lineage/res/res/values/config.xml | 1 + + .../app/LineageContextConstants.java | 28 ++ + sdk/src/java/lineageos/waydroid/AppInfo.aidl | 20 + + sdk/src/java/lineageos/waydroid/AppInfo.java | 57 +++ + .../java/lineageos/waydroid/Clipboard.java | 100 ++++ + sdk/src/java/lineageos/waydroid/Hardware.java | 116 +++++ + .../java/lineageos/waydroid/IClipboard.aidl | 23 + + .../java/lineageos/waydroid/IHardware.aidl | 24 + + .../java/lineageos/waydroid/IPlatform.aidl | 37 ++ + .../java/lineageos/waydroid/IUserMonitor.aidl | 23 + + sdk/src/java/lineageos/waydroid/Platform.java | 235 ++++++++++ + .../java/lineageos/waydroid/UserMonitor.java | 103 ++++ + 15 files changed, 1267 insertions(+), 1 deletion(-) + create mode 100644 lineage/lib/main/java/org/lineageos/platform/internal/WayDroidService.java + create mode 100644 sdk/src/java/lineageos/waydroid/AppInfo.aidl + create mode 100644 sdk/src/java/lineageos/waydroid/AppInfo.java + create mode 100644 sdk/src/java/lineageos/waydroid/Clipboard.java + create mode 100644 sdk/src/java/lineageos/waydroid/Hardware.java + create mode 100644 sdk/src/java/lineageos/waydroid/IClipboard.aidl + create mode 100644 sdk/src/java/lineageos/waydroid/IHardware.aidl + create mode 100644 sdk/src/java/lineageos/waydroid/IPlatform.aidl + create mode 100644 sdk/src/java/lineageos/waydroid/IUserMonitor.aidl + create mode 100644 sdk/src/java/lineageos/waydroid/Platform.java + create mode 100644 sdk/src/java/lineageos/waydroid/UserMonitor.java + +diff --git a/Android.mk b/Android.mk +index b813d480..f54137fa 100644 +--- a/Android.mk ++++ b/Android.mk +@@ -25,7 +25,7 @@ LOCAL_PATH := $(call my-dir) + lineage_platform_res := APPS/org.lineageos.platform-res_intermediates/aapt + + # List of packages used in lineage-api-stubs +-lineage_stub_packages := lineageos.app:lineageos.content:lineageos.hardware:lineageos.media:lineageos.os:lineageos.preference:lineageos.profiles:lineageos.providers:lineageos.platform:lineageos.power:lineageos.util:lineageos.weather:lineageos.weatherservice:lineageos.style:lineageos.trust ++lineage_stub_packages := lineageos.app:lineageos.content:lineageos.hardware:lineageos.media:lineageos.os:lineageos.preference:lineageos.profiles:lineageos.providers:lineageos.platform:lineageos.power:lineageos.util:lineageos.weather:lineageos.weatherservice:lineageos.style:lineageos.trust:lineageos.waydroid + + lineage_framework_module := $(LOCAL_INSTALLED_MODULE) + +diff --git a/api/lineage_current.txt b/api/lineage_current.txt +index 13e70b33..be53932f 100644 +--- a/api/lineage_current.txt ++++ b/api/lineage_current.txt +@@ -1176,3 +1176,60 @@ package lineageos.weatherservice { + + } + ++package lineageos.waydroid { ++ ++ public class AppInfo implements android.os.Parcelable { ++ ctor public AppInfo(); ++ method public int describeContents(); ++ method public void writeToParcel(android.os.Parcel, int); ++ method public void readFromParcel(android.os.Parcel); ++ } ++ ++ public class Clipboard { ++ method public static lineageos.waydroid.Clipboard getInstance(android.content.Context); ++ method public static lineageos.waydroid.Clipboard getService(); ++ method public void sendClipboardData(String); ++ method public String getClipboardData(); ++ } ++ ++ public class Hardware { ++ method public static lineageos.waydroid.Hardware getInstance(android.content.Context); ++ method public static lineageos.waydroid.Hardware getService(); ++ field public static final int ERROR_UNDEFINED = -1; // 0xffffffff ++ method public int enableNFC(boolean); ++ method public int enableBluetooth(boolean); ++ method public void suspend(); ++ } ++ ++ public class Platform { ++ method public static lineageos.waydroid.Platform getInstance(android.content.Context); ++ method public static lineageos.waydroid.Platform getService(); ++ field public static final int ERROR_UNDEFINED = -1; // 0xffffffff ++ field public static final int SETTINGS_SECURE = 0; // 0x0 ++ field public static final int SETTINGS_SYSTEM = 1; // 0x1 ++ field public static final int SETTINGS_GLOBAL = 2; // 0x2 ++ method public String getprop(String, String); ++ method public void setprop(String, String); ++ method public java.util.List getAppsInfo(); ++ method public lineageos.waydroid.AppInfo getAppInfo(String); ++ method public int installApp(String); ++ method public int removeApp(String); ++ method public void launchApp(String); ++ method public String getAppName(String); ++ method public void settingsPutString(int, String, String); ++ method public String settingsGetString(int, String); ++ method public void settingsPutInt(int, String, int); ++ method public int settingsGetInt(int, String); ++ } ++ ++ public class UserMonitor { ++ method public static lineageos.waydroid.UserMonitor getInstance(android.content.Context); ++ method public static lineageos.waydroid.UserMonitor getService(); ++ field public static final int WAYDROID_PACKAGE_ADDED = 0; // 0x0 ++ field public static final int WAYDROID_PACKAGE_REMOVED = 1; // 0x1 ++ field public static final int WAYDROID_PACKAGE_UPDATED = 2; // 0x2 ++ method public void userUnlocked(int); ++ method public void packageStateChanged(int, String, int); ++ } ++ ++} +diff --git a/lineage/lib/main/java/org/lineageos/platform/internal/WayDroidService.java b/lineage/lib/main/java/org/lineageos/platform/internal/WayDroidService.java +new file mode 100644 +index 00000000..755889d3 +--- /dev/null ++++ b/lineage/lib/main/java/org/lineageos/platform/internal/WayDroidService.java +@@ -0,0 +1,442 @@ ++/* ++ * Copyright (C) 2021 The WayDroid 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 org.lineageos.platform.internal; ++ ++import android.app.PendingIntent; ++import android.content.Context; ++import android.content.Intent; ++import android.content.pm.ApplicationInfo; ++import android.content.pm.PackageInstaller; ++import android.content.pm.PackageManager; ++import android.content.pm.PackageManager.NameNotFoundException; ++import android.content.pm.ResolveInfo; ++import android.os.IBinder; ++import android.os.RemoteException; ++import android.os.SystemProperties; ++import android.os.UserHandle; ++import android.provider.Settings; ++import android.util.Log; ++import android.net.Uri; ++import android.graphics.drawable.Drawable; ++import android.graphics.drawable.BitmapDrawable; ++import android.graphics.Bitmap; ++import android.graphics.Bitmap.Config; ++import android.graphics.Canvas; ++ ++import com.android.internal.content.PackageMonitor; ++import com.android.internal.os.BackgroundThread; ++ ++import lineageos.app.LineageContextConstants; ++import lineageos.waydroid.AppInfo; ++import lineageos.waydroid.IPlatform; ++import lineageos.waydroid.Platform; ++import lineageos.waydroid.IUserMonitor; ++import lineageos.waydroid.UserMonitor; ++ ++import java.util.ArrayList; ++import java.util.List; ++import java.io.File; ++import java.io.IOException; ++import java.io.InputStream; ++import java.io.OutputStream; ++import java.io.FileOutputStream; ++ ++import libcore.io.IoUtils; ++ ++/** @hide **/ ++public class WayDroidService extends LineageSystemService { ++ private static final String TAG = "WayDroidService"; ++ private static final String BROADCAST_ACTION_INSTALL = ++ "org.lineageos.platform.waydroid.ACTION_INSTALL_COMMIT"; ++ private static final String BROADCAST_ACTION_UNINSTALL = ++ "org.lineageos.platform.waydroid.ACTION_UNINSTALL_COMMIT"; ++ private static final String ICONS_DIR = "/data/icons"; ++ ++ private Context mContext; ++ private PackageManager mPm = null; ++ private UserMonitor mUM = null; ++ ++ public WayDroidService(Context context) { ++ super(context); ++ mContext = context; ++ if (context != null) { ++ mPm = context.getPackageManager(); ++ } else { ++ Log.w(TAG, "No context available"); ++ } ++ publishBinderService(LineageContextConstants.WAYDROID_PLATFORM_SERVICE, mPlatformService); ++ } ++ ++ @Override ++ public String getFeatureDeclaration() { ++ return LineageContextConstants.Features.HARDWARE_ABSTRACTION; ++ } ++ ++ @Override ++ public void onStart() { ++ if (mContext != null) { ++ if (UserMonitor.getService() != null) ++ mUM = UserMonitor.getInstance(mContext); ++ } else { ++ Log.w(TAG, "No context available"); ++ } ++ if (mUM != null) { ++ registerPackageMonitor(); ++ } ++ } ++ ++ @Override ++ public void onUnlockUser(int userHandle) { ++ List apps = mPm.getInstalledApplications(0); ++ for (int n = 0; n < apps.size(); n++) { ++ ApplicationInfo appInfo = apps.get(n); ++ ++ Intent launchIntent = mPm.getLaunchIntentForPackage(appInfo.packageName); ++ if (launchIntent == null) { ++ continue; ++ } ++ saveApplicationIcon(appInfo.packageName); ++ } ++ if (mUM != null) { ++ mUM.userUnlocked(userHandle); ++ } ++ Intent homeIntent = new Intent(Intent.ACTION_MAIN); ++ homeIntent.addCategory(Intent.CATEGORY_HOME); ++ ResolveInfo defaultLauncher = mPm.resolveActivity(homeIntent, PackageManager.MATCH_DEFAULT_ONLY); ++ if (defaultLauncher.activityInfo != null) { ++ String nameOfLauncherPkg = defaultLauncher.activityInfo.packageName; ++ SystemProperties.set("anbox.blacklist_apps", nameOfLauncherPkg); ++ } ++ } ++ ++ private void saveApplicationIcon(String packageName) { ++ Drawable icon = null; ++ try { ++ icon = mPm.getApplicationIcon(packageName); ++ } catch (PackageManager.NameNotFoundException ex) { ++ return; ++ } ++ if (icon == null) ++ return; ++ ++ Bitmap iconBitmap = drawableToBitmap(icon); ++ File imageFile = new File(ICONS_DIR, packageName + ".png"); ++ FileOutputStream fileOutStream = null; ++ try { ++ fileOutStream = new FileOutputStream(imageFile); ++ iconBitmap.compress(Bitmap.CompressFormat.PNG, 90, fileOutStream); ++ fileOutStream.close(); ++ } catch (IOException e) { ++ Log.e("app", e.getMessage()); ++ if (fileOutStream != null) { ++ try { ++ fileOutStream.close(); ++ } catch (IOException e1) { ++ e1.printStackTrace(); ++ } ++ } ++ } ++ } ++ ++ private Bitmap drawableToBitmap(Drawable drawable) { ++ if (drawable instanceof BitmapDrawable) ++ return ((BitmapDrawable)drawable).getBitmap(); ++ ++ Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Config.ARGB_8888); ++ Canvas canvas = new Canvas(bitmap); ++ drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); ++ drawable.draw(canvas); ++ ++ return bitmap; ++ } ++ ++ private void registerPackageMonitor() { ++ PackageMonitor monitor = new PackageMonitor() { ++ @Override ++ public void onPackageAdded(String packageName, int uid) { ++ if (mUM != null) { ++ mUM.packageStateChanged(UserMonitor.WAYDROID_PACKAGE_ADDED, packageName, uid); ++ } ++ saveApplicationIcon(packageName); ++ } ++ ++ @Override ++ public void onPackageRemoved(String packageName, int uid) { ++ if (mUM != null) { ++ mUM.packageStateChanged(UserMonitor.WAYDROID_PACKAGE_REMOVED, packageName, uid); ++ } ++ File appIcon = new File(ICONS_DIR + "/" + packageName + ".png"); ++ if (appIcon.exists()) ++ appIcon.delete(); ++ } ++ ++ @Override ++ public void onPackageUpdateFinished(String packageName, int uid) { ++ if (mUM != null) { ++ mUM.packageStateChanged(UserMonitor.WAYDROID_PACKAGE_UPDATED, packageName, uid); ++ } ++ saveApplicationIcon(packageName); ++ } ++ }; ++ ++ monitor.register(mContext, BackgroundThread.getHandler().getLooper(), UserHandle.ALL, true); ++ } ++ ++ /* Service */ ++ private final IBinder mPlatformService = new IPlatform.Stub() { ++ @Override ++ public String getprop(String prop, String default_value) { ++ return SystemProperties.get(prop, default_value); ++ } ++ ++ @Override ++ public void setprop(String prop, String value) { ++ SystemProperties.set(prop, value); ++ } ++ ++ @Override ++ public List getAppsInfo() { ++ List result = new ArrayList<>(); ++ ++ if (mPm == null) ++ return result; ++ ++ List apps = mPm.getInstalledApplications(0); ++ for (int n = 0; n < apps.size(); n++) { ++ ApplicationInfo appInfo = apps.get(n); ++ ++ Intent launchIntent = mPm.getLaunchIntentForPackage(appInfo.packageName); ++ if (launchIntent == null) { ++ continue; ++ } ++ ++ String name = appInfo.name; ++ CharSequence label = appInfo.loadLabel(mPm); ++ if (label != null) ++ name = label.toString(); ++ ++ AppInfo info = new AppInfo(); ++ info.name = name; ++ info.packageName = appInfo.packageName; ++ info.action = launchIntent.getAction(); ++ if (launchIntent.getData() != null) ++ info.launchIntent = launchIntent.getData().toString(); ++ else ++ info.launchIntent = ""; ++ ++ info.componentClassName = launchIntent.getComponent().getClassName(); ++ info.componentPackageName = launchIntent.getComponent().getPackageName(); ++ info.categories = new ArrayList(launchIntent.getCategories()); ++ result.add(info); ++ } ++ return result; ++ } ++ ++ @Override ++ public AppInfo getAppInfo(String packageName) { ++ if (mPm == null) ++ return null; ++ ++ ApplicationInfo appInfo; ++ try { ++ appInfo = mPm.getApplicationInfo(packageName, 0); ++ } catch (NameNotFoundException e) { ++ return null; ++ } ++ Intent launchIntent = mPm.getLaunchIntentForPackage(appInfo.packageName); ++ if (launchIntent == null) { ++ return null; ++ } ++ ++ String name = appInfo.name; ++ CharSequence label = appInfo.loadLabel(mPm); ++ if (label != null) ++ name = label.toString(); ++ ++ AppInfo info = new AppInfo(); ++ info.name = name; ++ info.packageName = appInfo.packageName; ++ info.action = launchIntent.getAction(); ++ if (launchIntent.getData() != null) ++ info.launchIntent = launchIntent.getData().toString(); ++ else ++ info.launchIntent = ""; ++ ++ info.componentClassName = launchIntent.getComponent().getClassName(); ++ info.componentPackageName = launchIntent.getComponent().getPackageName(); ++ info.categories = new ArrayList(launchIntent.getCategories()); ++ return info; ++ } ++ ++ @Override ++ public int installApp(String path) { ++ int ret = 0; ++ final Uri packageURI; ++ ++ // Populate apkURI, must be present ++ if (path != null) { ++ packageURI = Uri.fromFile(new File(path)); ++ } else { ++ return -1; ++ } ++ ++ final PackageInstaller.SessionParams params = new PackageInstaller.SessionParams( ++ PackageInstaller.SessionParams.MODE_FULL_INSTALL); ++ final PackageInstaller packageInstaller = mPm.getPackageInstaller(); ++ PackageInstaller.Session session = null; ++ try { ++ final int sessionId = packageInstaller.createSession(params); ++ final byte[] buffer = new byte[65536]; ++ session = packageInstaller.openSession(sessionId); ++ final InputStream in = mContext.getContentResolver().openInputStream(packageURI); ++ final OutputStream out = session.openWrite("PackageInstaller", 0, -1 /* sizeBytes, unknown */); ++ try { ++ int c; ++ while ((c = in.read(buffer)) != -1) { ++ out.write(buffer, 0, c); ++ } ++ session.fsync(out); ++ } finally { ++ IoUtils.closeQuietly(in); ++ IoUtils.closeQuietly(out); ++ } ++ // Create a PendingIntent and use it to generate the IntentSender ++ Intent broadcastIntent = new Intent(BROADCAST_ACTION_INSTALL); ++ PendingIntent pendingIntent = PendingIntent.getBroadcast( ++ mContext, ++ sessionId, ++ broadcastIntent, ++ PendingIntent.FLAG_UPDATE_CURRENT); ++ session.commit(pendingIntent.getIntentSender()); ++ } catch (IOException e) { ++ Log.e(TAG, "Failure", e); ++ ret = -1; ++ } finally { ++ IoUtils.closeQuietly(session); ++ } ++ ++ return ret; ++ } ++ ++ @Override ++ public int removeApp(String packageName) { ++ final PackageInstaller packageInstaller = mPm.getPackageInstaller(); ++ ++ mPm.setInstallerPackageName(packageName, mContext.getPackageName()); ++ // Create a PendingIntent and use it to generate the IntentSender ++ Intent broadcastIntent = new Intent(BROADCAST_ACTION_UNINSTALL); ++ PendingIntent pendingIntent = PendingIntent.getBroadcast( ++ mContext, // context ++ 0, // arbitary ++ broadcastIntent, ++ PendingIntent.FLAG_UPDATE_CURRENT); ++ packageInstaller.uninstall(packageName, pendingIntent.getIntentSender()); ++ ++ return 0; ++ } ++ ++ @Override ++ public void launchApp(String packageName) { ++ if (mPm == null || mContext == null) ++ return; ++ ++ ApplicationInfo appInfo; ++ try { ++ appInfo = mPm.getApplicationInfo(packageName, 0); ++ } catch (NameNotFoundException e) { ++ Log.e(TAG, e.getMessage()); ++ return; ++ } ++ Intent launchIntent = mPm.getLaunchIntentForPackage(appInfo.packageName); ++ if (launchIntent == null) { ++ return; ++ } ++ ++ mContext.startActivity(launchIntent); ++ } ++ ++ @Override ++ public String getAppName(String packageName) { ++ if (mPm == null || mContext == null) ++ return ""; ++ ++ ApplicationInfo appInfo; ++ try { ++ appInfo = mPm.getApplicationInfo(packageName, 0); ++ } catch (NameNotFoundException e) { ++ Log.e(TAG, e.getMessage()); ++ return ""; ++ } ++ String name = appInfo.name; ++ CharSequence label = appInfo.loadLabel(mPm); ++ if (label != null) ++ name = label.toString(); ++ ++ return name; ++ } ++ ++ @Override ++ public void settingsPutString(int mode, String key, String value) { ++ if (mode == Platform.SETTINGS_SECURE) { ++ Settings.Secure.putString(mContext.getContentResolver(), key, value); ++ } else if (mode == Platform.SETTINGS_SYSTEM) { ++ Settings.System.putString(mContext.getContentResolver(), key, value); ++ } else if (mode == Platform.SETTINGS_GLOBAL) { ++ Settings.Global.putString(mContext.getContentResolver(), key, value); ++ } ++ } ++ ++ @Override ++ public String settingsGetString(int mode, String key) { ++ if (mode == Platform.SETTINGS_SECURE) { ++ return Settings.Secure.getString(mContext.getContentResolver(), key); ++ } else if (mode == Platform.SETTINGS_SYSTEM) { ++ return Settings.System.getString(mContext.getContentResolver(), key); ++ } else if (mode == Platform.SETTINGS_GLOBAL) { ++ return Settings.Global.getString(mContext.getContentResolver(), key); ++ } ++ return ""; ++ } ++ ++ @Override ++ public void settingsPutInt(int mode, String key, int value) { ++ if (mode == Platform.SETTINGS_SECURE) { ++ Settings.Secure.putInt(mContext.getContentResolver(), key, value); ++ } else if (mode == Platform.SETTINGS_SYSTEM) { ++ Settings.System.putInt(mContext.getContentResolver(), key, value); ++ } else if (mode == Platform.SETTINGS_GLOBAL) { ++ Settings.Global.putInt(mContext.getContentResolver(), key, value); ++ } ++ } ++ ++ @Override ++ public int settingsGetInt(int mode, String key) { ++ try { ++ if (mode == Platform.SETTINGS_SECURE) { ++ return Settings.Secure.getInt(mContext.getContentResolver(), key); ++ } else if (mode == Platform.SETTINGS_SYSTEM) { ++ return Settings.System.getInt(mContext.getContentResolver(), key); ++ } else if (mode == Platform.SETTINGS_GLOBAL) { ++ return Settings.Global.getInt(mContext.getContentResolver(), key); ++ } ++ } catch (Settings.SettingNotFoundException e) { ++ Log.e(TAG, e.getMessage()); ++ } ++ return Platform.ERROR_UNDEFINED; ++ } ++ }; ++} +diff --git a/lineage/res/res/values/config.xml b/lineage/res/res/values/config.xml +index 0d950f36..f8b355e4 100644 +--- a/lineage/res/res/values/config.xml ++++ b/lineage/res/res/values/config.xml +@@ -107,6 +107,7 @@ + org.lineageos.platform.internal.LineageAudioService + org.lineageos.platform.internal.TrustInterfaceService + org.lineageos.platform.internal.LineageSettingsService ++ org.lineageos.platform.internal.WayDroidService + + + +diff --git a/sdk/src/java/lineageos/app/LineageContextConstants.java b/sdk/src/java/lineageos/app/LineageContextConstants.java +index 0b435b4d..a3b1e796 100644 +--- a/sdk/src/java/lineageos/app/LineageContextConstants.java ++++ b/sdk/src/java/lineageos/app/LineageContextConstants.java +@@ -107,6 +107,34 @@ public final class LineageContextConstants { + */ + public static final String LINEAGE_TRUST_INTERFACE = "lineagetrust"; + ++ /** ++ * Manages waydroid platform ++ * ++ * @hide ++ */ ++ public static final String WAYDROID_PLATFORM_SERVICE = "waydroidplatform"; ++ ++ /** ++ * Manages waydroid clipboard ++ * ++ * @hide ++ */ ++ public static final String WAYDROID_CLIPBOARD_SERVICE = "waydroidclipboard"; ++ ++ /** ++ * Manages waydroid hardware ++ * ++ * @hide ++ */ ++ public static final String WAYDROID_HARDWARE_SERVICE = "waydroidhardware"; ++ ++ /** ++ * Monitors waydroid user ++ * ++ * @hide ++ */ ++ public static final String WAYDROID_USERMONITOR_SERVICE = "waydroidusermonitor"; ++ + /** + * Features supported by the Lineage SDK. + */ +diff --git a/sdk/src/java/lineageos/waydroid/AppInfo.aidl b/sdk/src/java/lineageos/waydroid/AppInfo.aidl +new file mode 100644 +index 00000000..3d427ce5 +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/AppInfo.aidl +@@ -0,0 +1,20 @@ ++/* ++** ++** Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++parcelable AppInfo; +diff --git a/sdk/src/java/lineageos/waydroid/AppInfo.java b/sdk/src/java/lineageos/waydroid/AppInfo.java +new file mode 100644 +index 00000000..f0e99830 +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/AppInfo.java +@@ -0,0 +1,57 @@ ++package lineageos.waydroid; ++ ++import android.os.Parcel; ++import android.os.Parcelable; ++ ++import java.util.List; ++ ++public final class AppInfo implements Parcelable { ++ public String name; ++ public String packageName; ++ public String action; ++ public String launchIntent; ++ public String componentPackageName; ++ public String componentClassName; ++ public List categories; ++ ++ public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { ++ public AppInfo createFromParcel(Parcel in) { ++ return new AppInfo(in); ++ } ++ ++ public AppInfo[] newArray(int size) { ++ return new AppInfo[size]; ++ } ++ }; ++ ++ public AppInfo() { ++ } ++ ++ private AppInfo(Parcel in) { ++ readFromParcel(in); ++ } ++ ++ public void writeToParcel(Parcel out, int flags) { ++ out.writeString(name); ++ out.writeString(packageName); ++ out.writeString(action); ++ out.writeString(launchIntent); ++ out.writeString(componentPackageName); ++ out.writeString(componentClassName); ++ out.writeStringList(categories); ++ } ++ ++ public void readFromParcel(Parcel in) { ++ name = in.readString(); ++ packageName = in.readString(); ++ action = in.readString(); ++ launchIntent = in.readString(); ++ componentPackageName = in.readString(); ++ componentClassName = in.readString(); ++ in.readStringList(categories); ++ } ++ ++ public int describeContents() { ++ return 0; ++ } ++} +diff --git a/sdk/src/java/lineageos/waydroid/Clipboard.java b/sdk/src/java/lineageos/waydroid/Clipboard.java +new file mode 100644 +index 00000000..b70e22b0 +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/Clipboard.java +@@ -0,0 +1,100 @@ ++/** ++ * Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++import android.content.Context; ++import android.os.IBinder; ++import android.os.RemoteException; ++import android.os.ServiceManager; ++import android.util.Log; ++ ++import lineageos.app.LineageContextConstants; ++ ++public class Clipboard { ++ private static final String TAG = "WayDroidClipboard"; ++ ++ private static IClipboard sService; ++ private static Clipboard sInstance; ++ ++ private Context mContext; ++ ++ private Clipboard(Context context) { ++ Context appContext = context.getApplicationContext(); ++ mContext = appContext == null ? context : appContext; ++ sService = getService(); ++ if (sService == null) { ++ throw new RuntimeException("Unable to get WayDroidService. The service" + ++ " either crashed, was not started, or the interface has been called to early" + ++ " in SystemServer init"); ++ } ++ } ++ ++ /** ++ * Get or create an instance of the {@link lineageos.waydroid.Clipboard} ++ * ++ * @param context Used to get the service ++ * @return {@link Clipboard} ++ */ ++ public static Clipboard getInstance(Context context) { ++ if (sInstance == null) { ++ sInstance = new Clipboard(context); ++ } ++ return sInstance; ++ } ++ ++ /** @hide **/ ++ public static IClipboard getService() { ++ if (sService != null) { ++ return sService; ++ } ++ IBinder b = ServiceManager.getService(LineageContextConstants.WAYDROID_CLIPBOARD_SERVICE); ++ ++ if (b == null) { ++ Log.e(TAG, "null service. SAD!"); ++ return null; ++ } ++ ++ sService = IClipboard.Stub.asInterface(b); ++ return sService; ++ } ++ ++ /** @hide **/ ++ public void sendClipboardData(String value) { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.sendClipboardData(value); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++ ++ public String getClipboardData() { ++ if (sService == null) { ++ return ""; ++ } ++ try { ++ return sService.getClipboardData(); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ""; ++ } ++ ++} +diff --git a/sdk/src/java/lineageos/waydroid/Hardware.java b/sdk/src/java/lineageos/waydroid/Hardware.java +new file mode 100644 +index 00000000..ed46dff6 +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/Hardware.java +@@ -0,0 +1,116 @@ ++/** ++ * Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++import android.content.Context; ++import android.os.IBinder; ++import android.os.RemoteException; ++import android.os.ServiceManager; ++import android.util.Log; ++ ++import lineageos.app.LineageContextConstants; ++ ++public class Hardware { ++ private static final String TAG = "WayDroidHardware"; ++ ++ /** ++ * Unable to determine status, an error occured ++ */ ++ public static final int ERROR_UNDEFINED = -1; ++ ++ private static IHardware sService; ++ private static Hardware sInstance; ++ ++ private Context mContext; ++ ++ private Hardware(Context context) { ++ Context appContext = context.getApplicationContext(); ++ mContext = appContext == null ? context : appContext; ++ sService = getService(); ++ if (sService == null) { ++ throw new RuntimeException("Unable to get WayDroidService. The service" + ++ " either crashed, was not started, or the interface has been called to early" + ++ " in SystemServer init"); ++ } ++ } ++ ++ /** ++ * Get or create an instance of the {@link lineageos.waydroid.Hardware} ++ * ++ * @param context Used to get the service ++ * @return {@link Hardware} ++ */ ++ public static Hardware getInstance(Context context) { ++ if (sInstance == null) { ++ sInstance = new Hardware(context); ++ } ++ return sInstance; ++ } ++ ++ /** @hide **/ ++ public static IHardware getService() { ++ if (sService != null) { ++ return sService; ++ } ++ IBinder b = ServiceManager.getService(LineageContextConstants.WAYDROID_HARDWARE_SERVICE); ++ ++ if (b == null) { ++ Log.e(TAG, "null service. SAD!"); ++ return null; ++ } ++ ++ sService = IHardware.Stub.asInterface(b); ++ return sService; ++ } ++ ++ /** @hide **/ ++ public int enableNFC(boolean enable) { ++ if (sService == null) { ++ return ERROR_UNDEFINED; ++ } ++ try { ++ return sService.enableNFC(enable); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ERROR_UNDEFINED; ++ } ++ ++ public int enableBluetooth(boolean enable) { ++ if (sService == null) { ++ return ERROR_UNDEFINED; ++ } ++ try { ++ return sService.enableBluetooth(enable); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ERROR_UNDEFINED; ++ } ++ ++ public void suspend() { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.suspend(); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++} +diff --git a/sdk/src/java/lineageos/waydroid/IClipboard.aidl b/sdk/src/java/lineageos/waydroid/IClipboard.aidl +new file mode 100644 +index 00000000..b370e71a +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/IClipboard.aidl +@@ -0,0 +1,23 @@ ++/* ++** ++** Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++interface IClipboard { ++ void sendClipboardData(String value); ++ String getClipboardData(); ++} +diff --git a/sdk/src/java/lineageos/waydroid/IHardware.aidl b/sdk/src/java/lineageos/waydroid/IHardware.aidl +new file mode 100644 +index 00000000..8e56f5dd +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/IHardware.aidl +@@ -0,0 +1,24 @@ ++/* ++** ++** Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++interface IHardware { ++ int enableNFC(boolean enable); ++ int enableBluetooth(boolean enable); ++ void suspend(); ++} +diff --git a/sdk/src/java/lineageos/waydroid/IPlatform.aidl b/sdk/src/java/lineageos/waydroid/IPlatform.aidl +new file mode 100644 +index 00000000..01b68892 +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/IPlatform.aidl +@@ -0,0 +1,37 @@ ++/* ++** ++** Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++import lineageos.waydroid.AppInfo; ++ ++interface IPlatform { ++ String getprop(String prop, String default_value); ++ void setprop(String prop, String value); ++ ++ List getAppsInfo(); ++ AppInfo getAppInfo(String packageName); ++ int installApp(String path); ++ int removeApp(String packageName); ++ void launchApp(String packageName); ++ String getAppName(String packageName); ++ ++ void settingsPutString(int mode, String key, String value); ++ String settingsGetString(int mode, String key); ++ void settingsPutInt(int mode, String key, int value); ++ int settingsGetInt(int mode, String key); ++} +diff --git a/sdk/src/java/lineageos/waydroid/IUserMonitor.aidl b/sdk/src/java/lineageos/waydroid/IUserMonitor.aidl +new file mode 100644 +index 00000000..61afab44 +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/IUserMonitor.aidl +@@ -0,0 +1,23 @@ ++/* ++** ++** Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++interface IUserMonitor { ++ void userUnlocked(int uid); ++ void packageStateChanged(int mode, String packageName, int uid); ++} +diff --git a/sdk/src/java/lineageos/waydroid/Platform.java b/sdk/src/java/lineageos/waydroid/Platform.java +new file mode 100644 +index 00000000..59b85adb +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/Platform.java +@@ -0,0 +1,235 @@ ++/** ++ * Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++import android.content.Context; ++import android.os.IBinder; ++import android.os.RemoteException; ++import android.os.ServiceManager; ++import android.util.Log; ++ ++import lineageos.app.LineageContextConstants; ++ ++import java.util.List; ++import java.util.ArrayList; ++ ++public class Platform { ++ private static final String TAG = "WayDroidPlatform"; ++ ++ /** ++ * Unable to determine status, an error occured ++ */ ++ public static final int ERROR_UNDEFINED = -1; ++ ++ /** ++ * Settings providers ++ */ ++ public static final int SETTINGS_SECURE = 0; ++ public static final int SETTINGS_SYSTEM = 1; ++ public static final int SETTINGS_GLOBAL = 2; ++ ++ private static IPlatform sService; ++ private static Platform sInstance; ++ ++ private Context mContext; ++ ++ private Platform(Context context) { ++ Context appContext = context.getApplicationContext(); ++ mContext = appContext == null ? context : appContext; ++ sService = getService(); ++ if (sService == null) { ++ throw new RuntimeException("Unable to get WayDroidService. The service" + ++ " either crashed, was not started, or the interface has been called to early" + ++ " in SystemServer init"); ++ } ++ } ++ ++ /** ++ * Get or create an instance of the {@link lineageos.waydroid.Platform} ++ * ++ * @param context Used to get the service ++ * @return {@link Platform} ++ */ ++ public static Platform getInstance(Context context) { ++ if (sInstance == null) { ++ sInstance = new Platform(context); ++ } ++ return sInstance; ++ } ++ ++ /** @hide **/ ++ public static IPlatform getService() { ++ if (sService != null) { ++ return sService; ++ } ++ IBinder b = ServiceManager.getService(LineageContextConstants.WAYDROID_PLATFORM_SERVICE); ++ ++ if (b == null) { ++ Log.e(TAG, "null service. SAD!"); ++ return null; ++ } ++ ++ sService = IPlatform.Stub.asInterface(b); ++ return sService; ++ } ++ ++ /** @hide **/ ++ public String getprop(String prop, String default_value) { ++ if (sService == null) { ++ return default_value; ++ } ++ try { ++ return sService.getprop(prop, default_value); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return default_value; ++ } ++ ++ public void setprop(String prop, String value) { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.setprop(prop, value); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++ ++ public List getAppsInfo() { ++ List result = new ArrayList<>(); ++ if (sService == null) { ++ return result; ++ } ++ try { ++ result = sService.getAppsInfo(); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return result; ++ } ++ ++ public AppInfo getAppInfo(String packageName) { ++ if (sService == null) { ++ return null; ++ } ++ try { ++ return sService.getAppInfo(packageName); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return null; ++ } ++ ++ public int installApp(String path) { ++ if (sService == null) { ++ return ERROR_UNDEFINED; ++ } ++ try { ++ return sService.installApp(path); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ERROR_UNDEFINED; ++ } ++ ++ public int removeApp(String packageName) { ++ if (sService == null) { ++ return ERROR_UNDEFINED; ++ } ++ try { ++ return sService.removeApp(packageName); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ERROR_UNDEFINED; ++ } ++ ++ public void launchApp(String packageName) { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.launchApp(packageName); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++ ++ public String getAppName(String packageName) { ++ if (sService == null) { ++ return ""; ++ } ++ try { ++ return sService.getAppName(packageName); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ""; ++ } ++ ++ public void settingsPutString(int mode, String key, String value) { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.settingsPutString(mode, key, value); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++ ++ public String settingsGetString(int mode, String key) { ++ if (sService == null) { ++ return ""; ++ } ++ try { ++ return sService.settingsGetString(mode, key); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ""; ++ } ++ ++ public void settingsPutInt(int mode, String key, int value) { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.settingsPutInt(mode, key, value); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++ ++ public int settingsGetInt(int mode, String key) { ++ if (sService == null) { ++ return ERROR_UNDEFINED; ++ } ++ try { ++ return sService.settingsGetInt(mode, key); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return ERROR_UNDEFINED; ++ } ++} +diff --git a/sdk/src/java/lineageos/waydroid/UserMonitor.java b/sdk/src/java/lineageos/waydroid/UserMonitor.java +new file mode 100644 +index 00000000..96425a38 +--- /dev/null ++++ b/sdk/src/java/lineageos/waydroid/UserMonitor.java +@@ -0,0 +1,103 @@ ++/** ++ * Copyright (C) 2021 The WayDroid 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 lineageos.waydroid; ++ ++import android.content.Context; ++import android.os.IBinder; ++import android.os.RemoteException; ++import android.os.ServiceManager; ++import android.util.Log; ++ ++import lineageos.app.LineageContextConstants; ++ ++public class UserMonitor { ++ private static final String TAG = "WayDroidUserMonitor"; ++ ++ public static final int WAYDROID_PACKAGE_ADDED = 0; ++ public static final int WAYDROID_PACKAGE_REMOVED = 1; ++ public static final int WAYDROID_PACKAGE_UPDATED = 2; ++ ++ private static IUserMonitor sService; ++ private static UserMonitor sInstance; ++ ++ private Context mContext; ++ ++ private UserMonitor(Context context) { ++ Context appContext = context.getApplicationContext(); ++ mContext = appContext == null ? context : appContext; ++ sService = getService(); ++ if (sService == null) { ++ throw new RuntimeException("Unable to get WayDroidService. The service" + ++ " either crashed, was not started, or the interface has been called to early" + ++ " in SystemServer init"); ++ } ++ } ++ ++ /** ++ * Get or create an instance of the {@link lineageos.waydroid.UserMonitor} ++ * ++ * @param context Used to get the service ++ * @return {@link UserMonitor} ++ */ ++ public static UserMonitor getInstance(Context context) { ++ if (sInstance == null) { ++ sInstance = new UserMonitor(context); ++ } ++ return sInstance; ++ } ++ ++ /** @hide **/ ++ public static IUserMonitor getService() { ++ if (sService != null) { ++ return sService; ++ } ++ IBinder b = ServiceManager.getService(LineageContextConstants.WAYDROID_USERMONITOR_SERVICE); ++ ++ if (b == null) { ++ Log.e(TAG, "null service. SAD!"); ++ return null; ++ } ++ ++ sService = IUserMonitor.Stub.asInterface(b); ++ return sService; ++ } ++ ++ /** @hide **/ ++ public void userUnlocked(int uid) { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.userUnlocked(uid); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++ ++ public void packageStateChanged(int mode, String packageName, int uid) { ++ if (sService == null) { ++ return; ++ } ++ try { ++ sService.packageStateChanged(mode, packageName, uid); ++ } catch (RemoteException e) { ++ Log.e(TAG, e.getLocalizedMessage(), e); ++ } ++ return; ++ } ++} +-- +2.29.2 + From 2a07cef106c8eae21a99927d2ba30a1d34424d4a Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Wed, 11 Aug 2021 08:08:48 +0430 Subject: [PATCH 08/13] fw/base: synchronize clipboard with host --- ...ith-waydroid-host-service-to-get-cli.patch | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch diff --git a/frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch b/frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch new file mode 100644 index 0000000..c7098f5 --- /dev/null +++ b/frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch @@ -0,0 +1,93 @@ +From 3d9350d4c04d63869f240c8810a45e1b1fd4434f Mon Sep 17 00:00:00 2001 +From: Simon Fels +Date: Sun, 15 Jan 2017 12:35:43 +0100 +Subject: [PATCH] clipboard: Talk with waydroid host service to get clipboard + synchronized + +Change-Id: Ia038dae3393dc4887ac9477aff642541ffc230a3 +--- + .../server/clipboard/ClipboardService.java | 33 +++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/services/core/java/com/android/server/clipboard/ClipboardService.java b/services/core/java/com/android/server/clipboard/ClipboardService.java +index b279b370c61..899c9728b38 100644 +--- a/services/core/java/com/android/server/clipboard/ClipboardService.java ++++ b/services/core/java/com/android/server/clipboard/ClipboardService.java +@@ -68,6 +68,8 @@ import java.io.RandomAccessFile; + import java.util.HashSet; + import java.util.List; + ++import lineageos.waydroid.Clipboard; ++ + // The following class is Android Emulator specific. It is used to read and + // write contents of the host system's clipboard. + class HostClipboardMonitor implements Runnable { +@@ -172,6 +174,7 @@ public class ClipboardService extends SystemService { + private final IBinder mPermissionOwner; + private HostClipboardMonitor mHostClipboardMonitor = null; + private Thread mHostMonitorThread = null; ++ private Clipboard mWaydroidClipboard = null; + + private final SparseArray mClipboards = new SparseArray<>(); + +@@ -210,6 +213,9 @@ public class ClipboardService extends SystemService { + mHostMonitorThread = new Thread(mHostClipboardMonitor); + mHostMonitorThread.start(); + } ++ ++ if (Clipboard.getService() != null) ++ mWaydroidClipboard = Clipboard.getInstance(context); + } + + @Override +@@ -362,6 +368,11 @@ public class ClipboardService extends SystemService { + } + checkDataOwnerLocked(clip, intendingUid); + setPrimaryClipInternal(clip, intendingUid); ++ if (mWaydroidClipboard != null) { ++ ClipData.Item firstItem = clip.getItemAt(0); ++ String text = firstItem.getText().toString(); ++ mWaydroidClipboard.sendClipboardData(text); ++ } + } + } + +@@ -389,6 +400,17 @@ public class ClipboardService extends SystemService { + return null; + } + addActiveOwnerLocked(intendingUid, pkg); ++ if (mWaydroidClipboard != null) { ++ String waydroidPaste = mWaydroidClipboard.getClipboardData(); ++ if (getClipboard(intendingUserId).primaryClip != null && getClipboard(intendingUserId).primaryClip.getItemCount() > 0) { ++ ClipData.Item item = getClipboard(intendingUserId).primaryClip.getItemAt(0); ++ String itemText = item.getText().toString(); ++ if (itemText != waydroidPaste) { ++ ClipData data = ClipData.newPlainText("", waydroidPaste); ++ setPrimaryClipInternal(getClipboard(intendingUserId), data, intendingUserId); ++ } ++ } ++ } + return getClipboard(intendingUserId).primaryClip; + } + } +@@ -420,6 +442,17 @@ public class ClipboardService extends SystemService { + || isDeviceLocked(intendingUserId)) { + return false; + } ++ if (mWaydroidClipboard != null) { ++ String waydroidPaste = mWaydroidClipboard.getClipboardData(); ++ if (getClipboard(intendingUserId).primaryClip != null && getClipboard(intendingUserId).primaryClip.getItemCount() > 0) { ++ ClipData.Item item = getClipboard(intendingUserId).primaryClip.getItemAt(0); ++ String itemText = item.getText().toString(); ++ if (itemText != waydroidPaste) { ++ ClipData data = ClipData.newPlainText("", waydroidPaste); ++ setPrimaryClipInternal(getClipboard(intendingUserId), data, intendingUserId); ++ } ++ } ++ } + return getClipboard(intendingUserId).primaryClip != null; + } + } +-- +2.25.1 + From be5c96b57ebb42bcf28b2a0bc8b0afd2e08a5614 Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Wed, 11 Aug 2021 08:09:12 +0430 Subject: [PATCH 09/13] fw/base: New window management based on task id --- ...id-in-surface-name-for-easier-tracki.patch | 33 ++++++++++ ...pp-transitions-as-they-conflict-with.patch | 64 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch create mode 100644 frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch diff --git a/frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch b/frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch new file mode 100644 index 0000000..a6c745b --- /dev/null +++ b/frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch @@ -0,0 +1,33 @@ +From 7cc836e68b9c33c2c0b69a801744fe636f5364c2 Mon Sep 17 00:00:00 2001 +From: Simon Fels +Date: Thu, 8 Dec 2016 17:28:54 +0100 +Subject: [PATCH 1/2] wm: Include task id in surface name for easier tracking + +Change-Id: Ia64c3e8ef8e4514223649417d843d7ef65e2f5ba +--- + .../java/com/android/server/wm/WindowStateAnimator.java | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java +index 3505afb5e7a..ed86bfc0a1e 100644 +--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java ++++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java +@@ -484,8 +484,14 @@ class WindowStateAnimator { + flags |= SurfaceControl.OPAQUE; + } + ++ String name = attrs.getTitle().toString(); ++ Task task = mWin.getTask(); ++ if (task != null) { ++ name = String.format("TID:%d#", task.mTaskId) + name; ++ } ++ + mSurfaceController = new WindowSurfaceController(mSession.mSurfaceSession, +- attrs.getTitle().toString(), width, height, format, flags, this, ++ name, width, height, format, flags, this, + windowType, ownerUid); + mSurfaceController.setColorSpaceAgnostic((attrs.privateFlags + & WindowManager.LayoutParams.PRIVATE_FLAG_COLOR_SPACE_AGNOSTIC) != 0); +-- +2.25.1 + diff --git a/frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch b/frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch new file mode 100644 index 0000000..8e2cc6e --- /dev/null +++ b/frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch @@ -0,0 +1,64 @@ +From 7eede2e3bddaa64954d850159332d696e31bd1f8 Mon Sep 17 00:00:00 2001 +From: Simon Fels +Date: Thu, 10 Nov 2016 08:04:23 +0100 +Subject: [PATCH 2/2] wm: Disable all app transitions as they conflict with our + window management + +Change-Id: I208080ac83100f5e6e7116c041b17fdd8f9328ab +--- + .../java/com/android/server/policy/PhoneWindowManager.java | 2 +- + services/core/java/com/android/server/wm/AppTransition.java | 2 +- + .../core/java/com/android/server/wm/TaskSnapshotSurface.java | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java +index 2646b87a3db..16b6f871b85 100644 +--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java ++++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java +@@ -2903,7 +2903,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { + params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; + } + +- params.setTitle("Splash Screen " + packageName); ++ params.setTitle(packageName + "/SplashScreen"); + addSplashscreenContent(win, context); + + wm = (WindowManager) context.getSystemService(WINDOW_SERVICE); +diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java +index 52901bcef17..7678c0ab02e 100644 +--- a/services/core/java/com/android/server/wm/AppTransition.java ++++ b/services/core/java/com/android/server/wm/AppTransition.java +@@ -1795,7 +1795,7 @@ public class AppTransition implements Dump { + + " transit=" + appTransitionToString(transit) + " isEntrance=" + enter + + " Callers=" + Debug.getCallers(3)); + } +- return a; ++ return null; + } + + private Animation loadKeyguardExitAnimation(int transit) { +diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java +index 1905476f472..2c116b30ff2 100644 +--- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java ++++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java +@@ -112,7 +112,7 @@ class TaskSnapshotSurface implements StartingSurface { + + private static final String TAG = TAG_WITH_CLASS_NAME ? "SnapshotStartingWindow" : TAG_WM; + private static final int MSG_REPORT_DRAW = 0; +- private static final String TITLE_FORMAT = "SnapshotStartingWindow for taskId=%s"; ++ private static final String TITLE_FORMAT = "/SnapshotStartingWindow"; + private final Window mWindow; + private final Surface mSurface; + private SurfaceControl mSurfaceControl; +@@ -193,7 +193,7 @@ class TaskSnapshotSurface implements StartingSurface { + layoutParams.width = LayoutParams.MATCH_PARENT; + layoutParams.height = LayoutParams.MATCH_PARENT; + layoutParams.systemUiVisibility = sysUiVis; +- layoutParams.setTitle(String.format(TITLE_FORMAT, task.mTaskId)); ++ layoutParams.setTitle(mainWindow.getAttrs().packageName + TITLE_FORMAT); + + final TaskDescription td = task.getTaskDescription(); + if (td != null) { +-- +2.25.1 + From 9b9e48989e2aa0308a21f9efc437cfe7d30c3c6a Mon Sep 17 00:00:00 2001 From: Jon West Date: Thu, 12 Aug 2021 17:47:10 -0400 Subject: [PATCH 10/13] Update anbox patchset This includes patches for titlebar buttons, color format --- .../0001-anbox-disable-SELinux-parts.patch | 10 +- .../0002-anbox-disable-suspend-control.patch | 12 +- ...ize-sound-pool-audio-sample-loading.patch} | 9 +- ...tart-thread-pool-for-host-hwbinder-w.patch | 10 +- ...-fwb-Don-t-check-vintf-compatibility.patch | 6 +- ...e-system-from-entering-a-sleep-state.patch | 6 +- .../0007-core-Add-support-for-MicroG.patch | 10 +- ...add-a-permission-group-for-signature.patch | 8 +- .../base/0009-Zygote-Disable-seccomp.patch | 6 +- ...id-in-surface-name-for-easier-tracki.patch | 6 +- ...pp-transitions-as-they-conflict-with.patch | 12 +- ...ith-waydroid-host-service-to-get-cli.patch | 8 +- ...mize-pip-buttons-to-freeform-windows.patch | 412 ++++++++++++++++++ ...-Add-back-button-for-freeform-window.patch | 301 +++++++++++++ .../0015-Update-back-button-graphics.patch | 115 +++++ ...ult-format-when-persist.waydroid.use.patch | 55 +++ 16 files changed, 934 insertions(+), 52 deletions(-) rename base-patches/frameworks/base/{0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch => 0003-halbox-neutralize-sound-pool-audio-sample-loading.patch} (82%) create mode 100644 base-patches/frameworks/base/0013-Add-minimize-pip-buttons-to-freeform-windows.patch create mode 100644 base-patches/frameworks/base/0014-Add-back-button-for-freeform-window.patch create mode 100644 base-patches/frameworks/base/0015-Update-back-button-graphics.patch create mode 100644 base-patches/frameworks/native/0010-Use-BRGA-as-default-format-when-persist.waydroid.use.patch diff --git a/base-patches/frameworks/base/0001-anbox-disable-SELinux-parts.patch b/base-patches/frameworks/base/0001-anbox-disable-SELinux-parts.patch index 2b77bd6..65a1fa0 100644 --- a/base-patches/frameworks/base/0001-anbox-disable-SELinux-parts.patch +++ b/base-patches/frameworks/base/0001-anbox-disable-SELinux-parts.patch @@ -1,7 +1,7 @@ -From 14b812d586679092031fab8eade8edd7ce2dc815 Mon Sep 17 00:00:00 2001 +From 3f91aae2f62035de92d608edab1498616df4fe48 Mon Sep 17 00:00:00 2001 From: Asriel Dreemurr Date: Sun, 15 Nov 2020 00:24:05 +0700 -Subject: [PATCH] (anbox) disable SELinux parts +Subject: [PATCH 01/25] (anbox) disable SELinux parts Change-Id: I1bee5fb7f9f879e3bc9dc0c69cfb004fde8a320a --- @@ -10,7 +10,7 @@ Change-Id: I1bee5fb7f9f879e3bc9dc0c69cfb004fde8a320a 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp -index 440988b1bd4..d83bac8ab3a 100644 +index 440988b1bd4f..d83bac8ab3a0 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -1135,13 +1135,14 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids, @@ -55,7 +55,7 @@ index 440988b1bd4..d83bac8ab3a 100644 /* * Storage Initialization diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java -index a3dbfdc099d..84241e93dec 100644 +index a3dbfdc099d2..84241e93dec9 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -2636,18 +2636,18 @@ public final class Settings { @@ -81,5 +81,5 @@ index a3dbfdc099d..84241e93dec 100644 } -- -2.28.0 +2.25.1 diff --git a/base-patches/frameworks/base/0002-anbox-disable-suspend-control.patch b/base-patches/frameworks/base/0002-anbox-disable-suspend-control.patch index b23a50b..5779c18 100644 --- a/base-patches/frameworks/base/0002-anbox-disable-suspend-control.patch +++ b/base-patches/frameworks/base/0002-anbox-disable-suspend-control.patch @@ -1,7 +1,7 @@ -From bdf1502ae29eea2dcf9073b3d84e11d632e6aa30 Mon Sep 17 00:00:00 2001 +From 8ee21b531153f4e22f8ddf74428d5bf830e2c1dc Mon Sep 17 00:00:00 2001 From: Asriel Dreemurr Date: Sun, 15 Nov 2020 00:24:46 +0700 -Subject: [PATCH] (anbox) disable suspend control +Subject: [PATCH 02/25] (anbox) disable suspend control Change-Id: I1c8cbb5980efc063fae25597b3c6e927a682c1ca --- @@ -9,10 +9,10 @@ Change-Id: I1c8cbb5980efc063fae25597b3c6e927a682c1ca 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp -index bf0599fe18a..671b649c579 100644 +index 523f802141ec..27f7aaf11ac2 100644 --- a/services/core/jni/com_android_server_power_PowerManagerService.cpp +++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp -@@ -260,8 +260,9 @@ sp getSuspendControl() { +@@ -248,8 +248,9 @@ sp getSuspendControl() { void enableAutoSuspend() { static bool enabled = false; if (!enabled) { @@ -24,7 +24,7 @@ index bf0599fe18a..671b649c579 100644 } { -@@ -276,9 +277,10 @@ void enableAutoSuspend() { +@@ -264,9 +265,10 @@ void enableAutoSuspend() { void disableAutoSuspend() { std::lock_guard lock(gSuspendMutex); if (!gSuspendBlocker) { @@ -38,5 +38,5 @@ index bf0599fe18a..671b649c579 100644 } -- -2.28.0 +2.25.1 diff --git a/base-patches/frameworks/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch b/base-patches/frameworks/base/0003-halbox-neutralize-sound-pool-audio-sample-loading.patch similarity index 82% rename from base-patches/frameworks/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch rename to base-patches/frameworks/base/0003-halbox-neutralize-sound-pool-audio-sample-loading.patch index d40f870..171830b 100644 --- a/base-patches/frameworks/base/0003-temp-anbox-neutralize-sound-pool-audio-sample-loadi.patch +++ b/base-patches/frameworks/base/0003-halbox-neutralize-sound-pool-audio-sample-loading.patch @@ -1,8 +1,7 @@ -From 0e4ffed63bf89dad6a5cead06584ec70f65933d8 Mon Sep 17 00:00:00 2001 +From ec9ee01a00655e64da31f0abf437711ced9ea63c Mon Sep 17 00:00:00 2001 From: Asriel Dreemurr Date: Sun, 15 Nov 2020 00:25:07 +0700 -Subject: [PATCH] [temp] (halbox) neutralize sound pool audio sample - loading +Subject: [PATCH 03/25] (halbox) neutralize sound pool audio sample loading Change-Id: I395137bec139e0bfc33792d06e11db212eb9434a --- @@ -10,7 +9,7 @@ Change-Id: I395137bec139e0bfc33792d06e11db212eb9434a 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/media/jni/soundpool/SoundPoolThread.cpp b/media/jni/soundpool/SoundPoolThread.cpp -index ba3b482935d..b0d0b9fc506 100644 +index ba3b482935dd..b0d0b9fc5060 100644 --- a/media/jni/soundpool/SoundPoolThread.cpp +++ b/media/jni/soundpool/SoundPoolThread.cpp @@ -105,9 +105,10 @@ void SoundPoolThread::loadSample(int sampleID) { @@ -27,5 +26,5 @@ index ba3b482935d..b0d0b9fc506 100644 } -- -2.28.0 +2.25.1 diff --git a/base-patches/frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch b/base-patches/frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch index db68c15..0febb91 100644 --- a/base-patches/frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch +++ b/base-patches/frameworks/base/0004-anbox-core-jni-start-thread-pool-for-host-hwbinder-w.patch @@ -1,15 +1,15 @@ -From 3706032c94b414148fcf562e9eb0475d537fb8e7 Mon Sep 17 00:00:00 2001 +From 73382db343977dc043c2f2c02f13c2159918a58b Mon Sep 17 00:00:00 2001 From: Asriel Dreemurr Date: Wed, 28 Apr 2021 15:44:32 +0700 -Subject: [PATCH] (anbox) core/jni: start thread pool for host hwbinder when - needed +Subject: [PATCH 04/25] (anbox) core/jni: start thread pool for host hwbinder + when needed --- core/jni/android_os_HwBinder.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp -index 42e3942e..c4e5db37 100644 +index 42e3942eb350..c4e5db37b7ed 100644 --- a/core/jni/android_os_HwBinder.cpp +++ b/core/jni/android_os_HwBinder.cpp @@ -329,8 +329,9 @@ static jobject JHwBinder_native_getService( @@ -25,5 +25,5 @@ index 42e3942e..c4e5db37 100644 return JHwRemoteBinder::NewObject(env, service); } -- -2.17.1 +2.25.1 diff --git a/base-patches/frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch b/base-patches/frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch index a93790d..1f8c20b 100644 --- a/base-patches/frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch +++ b/base-patches/frameworks/base/0005-fwb-Don-t-check-vintf-compatibility.patch @@ -1,7 +1,7 @@ -From f312eae7fed610fce6e5e51e1a47d493c457d868 Mon Sep 17 00:00:00 2001 +From b953486c91a88945ee2ef1fd60a644b769776102 Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Tue, 20 Apr 2021 16:33:54 +0800 -Subject: [PATCH] fwb: Don't check vintf compatibility +Subject: [PATCH 05/25] fwb: Don't check vintf compatibility Change-Id: I7a611be5bf7502da979f7ccbd0f71f9749be04c8 --- @@ -9,7 +9,7 @@ Change-Id: I7a611be5bf7502da979f7ccbd0f71f9749be04c8 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java -index 31403773aff..7bf0323c1b5 100755 +index 31403773aff3..7bf0323c1b56 100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -1067,7 +1067,7 @@ public class Build { diff --git a/base-patches/frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch b/base-patches/frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch index 6521ac9..8128551 100644 --- a/base-patches/frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch +++ b/base-patches/frameworks/base/0006-Prevent-the-system-from-entering-a-sleep-state.patch @@ -1,14 +1,14 @@ -From e77ae92d8b2ec2f98489062a07acaec0c99f4e7c Mon Sep 17 00:00:00 2001 +From 5eb0e1531e4096468a3a91ab1883a4c86d579087 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Sun, 20 Nov 2016 12:11:41 +0100 -Subject: [PATCH 3/3] Prevent the system from entering a sleep state +Subject: [PATCH 06/25] Prevent the system from entering a sleep state --- .../com/android/server/power/PowerManagerService.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java -index ca37b59b543..3dbb3f95bc0 100644 +index ca37b59b543c..3dbb3f95bc07 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -1101,8 +1101,7 @@ public final class PowerManagerService extends SystemService diff --git a/base-patches/frameworks/base/0007-core-Add-support-for-MicroG.patch b/base-patches/frameworks/base/0007-core-Add-support-for-MicroG.patch index 1f25db8..3e29173 100644 --- a/base-patches/frameworks/base/0007-core-Add-support-for-MicroG.patch +++ b/base-patches/frameworks/base/0007-core-Add-support-for-MicroG.patch @@ -1,7 +1,7 @@ -From db3ad61397f2ddd579d055316e486a8d30aaf42c Mon Sep 17 00:00:00 2001 +From 3df14166c2990a1d370071d6dff2b59258bec312 Mon Sep 17 00:00:00 2001 From: gudenau Date: Tue, 25 Sep 2018 09:44:26 +0200 -Subject: [PATCH 1/3] core: Add support for MicroG +Subject: [PATCH 07/25] core: Add support for MicroG -fake signatures, enabled per app by dynamic permission @@ -13,7 +13,7 @@ Change-Id: I84fc7e5c606f4b57012d948a4cc6cb521db6b03e 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index 7bcd7a048db..10853678f39 100644 +index 7bcd7a048db4..10853678f393 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2655,6 +2655,13 @@ @@ -31,7 +31,7 @@ index 7bcd7a048db..10853678f39 100644 {@link android.content.pm.PackageManager#addPackageToPreferred} for details. --> diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml -index 972ed01636d..9c55e4428b4 100644 +index 972ed01636d0..9c55e4428b46 100644 --- a/core/res/res/values/cm_strings.xml +++ b/core/res/res/values/cm_strings.xml @@ -29,4 +29,10 @@ @@ -46,7 +46,7 @@ index 972ed01636d..9c55e4428b4 100644 + diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java -index 2f2c1689b4e..28d9bfaaadb 100644 +index 9acdb2652db8..859d4254242e 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -4203,8 +4203,9 @@ public class PackageManagerService extends IPackageManager.Stub diff --git a/base-patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch b/base-patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch index 653516f..9ab2dc9 100644 --- a/base-patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch +++ b/base-patches/frameworks/base/0008-AndroidManifest-add-a-permission-group-for-signature.patch @@ -1,7 +1,7 @@ -From 5b989fcbe22653614074adccd31bab861a2d62dc Mon Sep 17 00:00:00 2001 +From 219aba1829c7c5263f7522880f3884e1f6c4004a Mon Sep 17 00:00:00 2001 From: Vachounet Date: Wed, 12 Feb 2020 11:34:33 +0100 -Subject: [PATCH 2/3] AndroidManifest: add a permission group for signature +Subject: [PATCH 08/25] AndroidManifest: add a permission group for signature spoofing Needed by PackageInstaller while checking for modern permission group @@ -13,7 +13,7 @@ Change-Id: Ibb402960dcde6d21106d1481ca7c3cd314fd2ac1 2 files changed, 15 insertions(+) diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index 10853678f39..15a573f2c74 100644 +index 10853678f393..15a573f2c744 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -2655,9 +2655,17 @@ @@ -35,7 +35,7 @@ index 10853678f39..15a573f2c74 100644 android:label="@string/permlab_fakePackageSignature" android:description="@string/permdesc_fakePackageSignature" /> diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml -index 9c55e4428b4..674583b3a0e 100644 +index 9c55e4428b46..674583b3a0ec 100644 --- a/core/res/res/values/cm_strings.xml +++ b/core/res/res/values/cm_strings.xml @@ -34,5 +34,12 @@ diff --git a/base-patches/frameworks/base/0009-Zygote-Disable-seccomp.patch b/base-patches/frameworks/base/0009-Zygote-Disable-seccomp.patch index cecf15f..8073beb 100644 --- a/base-patches/frameworks/base/0009-Zygote-Disable-seccomp.patch +++ b/base-patches/frameworks/base/0009-Zygote-Disable-seccomp.patch @@ -1,7 +1,7 @@ -From 7739bc338b7fb8700dffffda9e82d18ce20d02fb Mon Sep 17 00:00:00 2001 +From b57c2e182b059a3c49e0ada39f68eb2a273f00f4 Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Thu, 17 Jun 2021 01:39:59 +0800 -Subject: [PATCH] Zygote: Disable seccomp +Subject: [PATCH 09/25] Zygote: Disable seccomp Change-Id: Ia29148f887a6fdcbc65803a4dec1a881b353df95 --- @@ -9,7 +9,7 @@ Change-Id: Ia29148f887a6fdcbc65803a4dec1a881b353df95 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp -index d83bac8ab3a..8dc366eab4e 100644 +index d83bac8ab3a0..8dc366eab4e8 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -532,7 +532,7 @@ static void PreApplicationInit() { diff --git a/base-patches/frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch b/base-patches/frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch index a6c745b..8b71e63 100644 --- a/base-patches/frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch +++ b/base-patches/frameworks/base/0010-wm-Include-task-id-in-surface-name-for-easier-tracki.patch @@ -1,7 +1,7 @@ -From 7cc836e68b9c33c2c0b69a801744fe636f5364c2 Mon Sep 17 00:00:00 2001 +From 792b7865341cb7194377f883f024d6c480adcb60 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Thu, 8 Dec 2016 17:28:54 +0100 -Subject: [PATCH 1/2] wm: Include task id in surface name for easier tracking +Subject: [PATCH 10/25] wm: Include task id in surface name for easier tracking Change-Id: Ia64c3e8ef8e4514223649417d843d7ef65e2f5ba --- @@ -9,7 +9,7 @@ Change-Id: Ia64c3e8ef8e4514223649417d843d7ef65e2f5ba 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java -index 3505afb5e7a..ed86bfc0a1e 100644 +index 3505afb5e7a3..ed86bfc0a1ec 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -484,8 +484,14 @@ class WindowStateAnimator { diff --git a/base-patches/frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch b/base-patches/frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch index 8e2cc6e..30abcb0 100644 --- a/base-patches/frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch +++ b/base-patches/frameworks/base/0011-wm-Disable-all-app-transitions-as-they-conflict-with.patch @@ -1,8 +1,8 @@ -From 7eede2e3bddaa64954d850159332d696e31bd1f8 Mon Sep 17 00:00:00 2001 +From 95b0d3a8a16e1e07bc9a05b14b2f1109dcbf5983 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Thu, 10 Nov 2016 08:04:23 +0100 -Subject: [PATCH 2/2] wm: Disable all app transitions as they conflict with our - window management +Subject: [PATCH 11/25] wm: Disable all app transitions as they conflict with + our window management Change-Id: I208080ac83100f5e6e7116c041b17fdd8f9328ab --- @@ -12,7 +12,7 @@ Change-Id: I208080ac83100f5e6e7116c041b17fdd8f9328ab 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java -index 2646b87a3db..16b6f871b85 100644 +index 2646b87a3db4..16b6f871b853 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -2903,7 +2903,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { @@ -25,7 +25,7 @@ index 2646b87a3db..16b6f871b85 100644 wm = (WindowManager) context.getSystemService(WINDOW_SERVICE); diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java -index 52901bcef17..7678c0ab02e 100644 +index 52901bcef176..7678c0ab02e0 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -1795,7 +1795,7 @@ public class AppTransition implements Dump { @@ -38,7 +38,7 @@ index 52901bcef17..7678c0ab02e 100644 private Animation loadKeyguardExitAnimation(int transit) { diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java -index 1905476f472..2c116b30ff2 100644 +index 1905476f4729..2c116b30ff2d 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java @@ -112,7 +112,7 @@ class TaskSnapshotSurface implements StartingSurface { diff --git a/base-patches/frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch b/base-patches/frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch index c7098f5..b073e8f 100644 --- a/base-patches/frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch +++ b/base-patches/frameworks/base/0012-clipboard-Talk-with-waydroid-host-service-to-get-cli.patch @@ -1,8 +1,8 @@ -From 3d9350d4c04d63869f240c8810a45e1b1fd4434f Mon Sep 17 00:00:00 2001 +From df19e09cafbba22fdd5efe30535122eedabc384d Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Sun, 15 Jan 2017 12:35:43 +0100 -Subject: [PATCH] clipboard: Talk with waydroid host service to get clipboard - synchronized +Subject: [PATCH 12/25] clipboard: Talk with waydroid host service to get + clipboard synchronized Change-Id: Ia038dae3393dc4887ac9477aff642541ffc230a3 --- @@ -10,7 +10,7 @@ Change-Id: Ia038dae3393dc4887ac9477aff642541ffc230a3 1 file changed, 33 insertions(+) diff --git a/services/core/java/com/android/server/clipboard/ClipboardService.java b/services/core/java/com/android/server/clipboard/ClipboardService.java -index b279b370c61..899c9728b38 100644 +index b279b370c611..899c9728b38e 100644 --- a/services/core/java/com/android/server/clipboard/ClipboardService.java +++ b/services/core/java/com/android/server/clipboard/ClipboardService.java @@ -68,6 +68,8 @@ import java.io.RandomAccessFile; diff --git a/base-patches/frameworks/base/0013-Add-minimize-pip-buttons-to-freeform-windows.patch b/base-patches/frameworks/base/0013-Add-minimize-pip-buttons-to-freeform-windows.patch new file mode 100644 index 0000000..be38414 --- /dev/null +++ b/base-patches/frameworks/base/0013-Add-minimize-pip-buttons-to-freeform-windows.patch @@ -0,0 +1,412 @@ +From 9ec17c0ad661e9c0a08837d166c93a40e2aa8199 Mon Sep 17 00:00:00 2001 +From: Jon West +Date: Sat, 8 Feb 2020 15:06:39 -0500 +Subject: [PATCH 13/25] Add minimize & pip buttons to freeform windows + +Thanks to @farmerbb for assistance and @rogerdott for the graphics + +Change-Id: I8ddad6eab27f52574ee1c10e8006612fb46a83c5 +--- + config/hiddenapi-greylist-max-o.txt | 4 ++ + core/java/android/view/Window.java | 2 + + .../android/internal/policy/DecorView.java | 8 ++++ + .../internal/widget/DecorCaptionView.java | 38 ++++++++++++++++++- + .../drawable/decor_minimize_button_dark.xml | 30 +++++++++++++++ + .../drawable/decor_minimize_button_light.xml | 30 +++++++++++++++ + .../res/drawable/decor_pip_button_dark.xml | 29 ++++++++++++++ + .../res/drawable/decor_pip_button_light.xml | 29 ++++++++++++++ + core/res/res/layout/decor_caption.xml | 18 +++++++++ + core/res/res/values/arrays.xml | 4 ++ + core/res/res/values/strings.xml | 4 ++ + core/res/res/values/symbols.xml | 6 +++ + 12 files changed, 200 insertions(+), 2 deletions(-) + create mode 100644 core/res/res/drawable/decor_minimize_button_dark.xml + create mode 100644 core/res/res/drawable/decor_minimize_button_light.xml + create mode 100644 core/res/res/drawable/decor_pip_button_dark.xml + create mode 100644 core/res/res/drawable/decor_pip_button_light.xml + +diff --git a/config/hiddenapi-greylist-max-o.txt b/config/hiddenapi-greylist-max-o.txt +index d9c1cd0313fc..006cc4496b04 100644 +--- a/config/hiddenapi-greylist-max-o.txt ++++ b/config/hiddenapi-greylist-max-o.txt +@@ -98210,6 +98210,10 @@ Lcom/android/internal/R$drawable;->decor_close_button_dark:I + Lcom/android/internal/R$drawable;->decor_close_button_light:I + Lcom/android/internal/R$drawable;->decor_maximize_button_dark:I + Lcom/android/internal/R$drawable;->decor_maximize_button_light:I ++Lcom/android/internal/R$drawable;->decor_minimize_button_dark:I ++Lcom/android/internal/R$drawable;->decor_minimize_button_light:I ++Lcom/android/internal/R$drawable;->decor_pip_button_dark:I ++Lcom/android/internal/R$drawable;->decor_pip_button_light:I + Lcom/android/internal/R$drawable;->default_lock_wallpaper:I + Lcom/android/internal/R$drawable;->default_wallpaper:I + Lcom/android/internal/R$drawable;->dialog_frame:I +diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java +index aa19ed272662..f01cbf122d53 100644 +--- a/core/java/android/view/Window.java ++++ b/core/java/android/view/Window.java +@@ -636,6 +636,8 @@ public abstract class Window { + + /** Returns whether the window belongs to the task root. */ + boolean isTaskRoot(); ++ ++ boolean moveTaskToBack(boolean nonRoot); + } + + /** +diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java +index 07002d788908..8749dad8139f 100644 +--- a/core/java/com/android/internal/policy/DecorView.java ++++ b/core/java/com/android/internal/policy/DecorView.java +@@ -2195,6 +2195,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind + } + + private void setLightDecorCaptionShade(DecorCaptionView view) { ++ view.findViewById(R.id.pip_window).setBackgroundResource( ++ R.drawable.decor_pip_button_light); ++ view.findViewById(R.id.minimize_window).setBackgroundResource( ++ R.drawable.decor_minimize_button_light); + view.findViewById(R.id.maximize_window).setBackgroundResource( + R.drawable.decor_maximize_button_light); + view.findViewById(R.id.close_window).setBackgroundResource( +@@ -2202,6 +2206,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind + } + + private void setDarkDecorCaptionShade(DecorCaptionView view) { ++ view.findViewById(R.id.pip_window).setBackgroundResource( ++ R.drawable.decor_pip_button_dark); ++ view.findViewById(R.id.minimize_window).setBackgroundResource( ++ R.drawable.decor_minimize_button_dark); + view.findViewById(R.id.maximize_window).setBackgroundResource( + R.drawable.decor_maximize_button_dark); + view.findViewById(R.id.close_window).setBackgroundResource( +diff --git a/core/java/com/android/internal/widget/DecorCaptionView.java b/core/java/com/android/internal/widget/DecorCaptionView.java +index 4014c454f6a8..126aeb4df2ad 100644 +--- a/core/java/com/android/internal/widget/DecorCaptionView.java ++++ b/core/java/com/android/internal/widget/DecorCaptionView.java +@@ -86,6 +86,8 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + + private View mCaption; + private View mContent; ++ private View mPip; ++ private View mMinimize; + private View mMaximize; + private View mClose; + +@@ -102,6 +104,8 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + private GestureDetector mGestureDetector; + private final Rect mCloseRect = new Rect(); + private final Rect mMaximizeRect = new Rect(); ++ private final Rect mMinimizeRect = new Rect(); ++ private final Rect mPipRect = new Rect(); + private View mClickTarget; + private int mRootScrollY; + +@@ -144,6 +148,8 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + // By changing the outline provider to BOUNDS, the window can remove its + // background without removing the shadow. + mOwner.getDecorView().setOutlineProvider(ViewOutlineProvider.BOUNDS); ++ mPip = findViewById(R.id.pip_window); ++ mMinimize = findViewById(R.id.minimize_window); + mMaximize = findViewById(R.id.maximize_window); + mClose = findViewById(R.id.close_window); + } +@@ -156,6 +162,12 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + final int x = (int) ev.getX(); + final int y = (int) ev.getY(); + // Only offset y for containment tests because the actual views are already translated. ++ if (mPipRect.contains(x, y - mRootScrollY)) { ++ mClickTarget = mPip; ++ } ++ if (mMinimizeRect.contains(x, y - mRootScrollY)) { ++ mClickTarget = mMinimize; ++ } + if (mMaximizeRect.contains(x, y - mRootScrollY)) { + mClickTarget = mMaximize; + } +@@ -307,10 +319,14 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + if (mCaption.getVisibility() != View.GONE) { + mCaption.layout(0, 0, mCaption.getMeasuredWidth(), mCaption.getMeasuredHeight()); + captionHeight = mCaption.getBottom() - mCaption.getTop(); ++ mPip.getHitRect(mPipRect); ++ mMinimize.getHitRect(mMinimizeRect); + mMaximize.getHitRect(mMaximizeRect); + mClose.getHitRect(mCloseRect); + } else { + captionHeight = 0; ++ mPipRect.setEmpty(); ++ mMinimizeRect.setEmpty(); + mMaximizeRect.setEmpty(); + mCloseRect.setEmpty(); + } +@@ -325,7 +341,7 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + } + + // This assumes that the caption bar is at the top. +- mOwner.notifyRestrictedCaptionAreaCallback(mMaximize.getLeft(), mMaximize.getTop(), ++ mOwner.notifyRestrictedCaptionAreaCallback(mPip.getLeft(), mMaximize.getTop(), + mClose.getRight(), mClose.getBottom()); + } + +@@ -351,6 +367,20 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + } + } + ++ private void minimizeWindow() { ++ Window.WindowControllerCallback callback = mOwner.getWindowControllerCallback(); ++ if (callback != null) { ++ callback.moveTaskToBack(true); ++ } ++ } ++ ++ private void pipWindow() { ++ Window.WindowControllerCallback callback = mOwner.getWindowControllerCallback(); ++ if (callback != null) { ++ callback.enterPictureInPictureModeIfPossible(); /* Send the task to PIP mode if the task supports it. */ ++ } ++ } ++ + public boolean isCaptionShowing() { + return mShow; + } +@@ -403,7 +433,11 @@ public class DecorCaptionView extends ViewGroup implements View.OnTouchListener, + + @Override + public boolean onSingleTapUp(MotionEvent e) { +- if (mClickTarget == mMaximize) { ++ if (mClickTarget == mMinimize) { ++ minimizeWindow(); ++ } else if (mClickTarget == mPip) { ++ pipWindow(); ++ } else if (mClickTarget == mMaximize) { + toggleFreeformWindowingMode(); + } else if (mClickTarget == mClose) { + mOwner.dispatchOnWindowDismissed( +diff --git a/core/res/res/drawable/decor_minimize_button_dark.xml b/core/res/res/drawable/decor_minimize_button_dark.xml +new file mode 100644 +index 000000000000..7143d6cb6d2b +--- /dev/null ++++ b/core/res/res/drawable/decor_minimize_button_dark.xml +@@ -0,0 +1,30 @@ ++ ++ ++ ++ ++ ++ +diff --git a/core/res/res/drawable/decor_minimize_button_light.xml b/core/res/res/drawable/decor_minimize_button_light.xml +new file mode 100644 +index 000000000000..876641cfbd01 +--- /dev/null ++++ b/core/res/res/drawable/decor_minimize_button_light.xml +@@ -0,0 +1,30 @@ ++ ++ ++ ++ ++ +diff --git a/core/res/res/drawable/decor_pip_button_dark.xml b/core/res/res/drawable/decor_pip_button_dark.xml +new file mode 100644 +index 000000000000..8a1c43c26aec +--- /dev/null ++++ b/core/res/res/drawable/decor_pip_button_dark.xml +@@ -0,0 +1,29 @@ ++ ++ ++ ++ +diff --git a/core/res/res/drawable/decor_pip_button_light.xml b/core/res/res/drawable/decor_pip_button_light.xml +new file mode 100644 +index 000000000000..84433b5f1ea0 +--- /dev/null ++++ b/core/res/res/drawable/decor_pip_button_light.xml +@@ -0,0 +1,29 @@ ++ ++ ++ ++ +diff --git a/core/res/res/layout/decor_caption.xml b/core/res/res/layout/decor_caption.xml +index 02467369825d..55edbfcfbb91 100644 +--- a/core/res/res/layout/decor_caption.xml ++++ b/core/res/res/layout/decor_caption.xml +@@ -30,6 +30,24 @@ + android:background="@drawable/decor_caption_title" + android:focusable="false" + android:descendantFocusability="blocksDescendants" > ++