├── Android.mk ├── AndroidProducts.mk ├── BoardConfig.mk ├── LICENSE ├── README.md ├── RemovePackages └── Android.mk ├── aosp_pocket2.mk ├── bluetooth └── bdroid_buildcfg.h ├── configs ├── compatibility_matrix.xml ├── manifest.xml └── wifi │ ├── p2p_supplicant_overlay.conf │ ├── wpa_supplicant.conf │ └── wpa_supplicant_overlay.conf ├── copy-files.sh ├── device-tablet.mk ├── device.mk ├── extract-files.sh ├── hidl.mk ├── include ├── fd_utils-inl-extra.h └── hardware │ └── audio.h ├── kernel ├── lineage.dependencies ├── lineage_atv_pocket2.mk ├── lineage_pocket2.mk ├── lineagehw └── org │ └── lineageos │ └── hardware │ └── DisplayColorCalibration.java ├── mtk ├── Android.mk ├── lib_driver_cmd_mt66xx │ ├── Android.mk │ ├── README │ ├── mediatek_driver_cmd_nl80211.c │ └── mediatek_driver_nl80211.h └── libwifi-hal-mt66xx │ ├── Android.mk │ ├── NOTICE │ ├── README │ ├── common.cpp │ ├── common.h │ ├── cpp_bindings.cpp │ ├── cpp_bindings.h │ ├── gscan.cpp │ ├── link_layer_stats.cpp │ ├── rtt.cpp │ ├── sync.h │ ├── wifi_hal.cpp │ ├── wifi_logger.cpp │ └── wifi_offload.cpp ├── overlay ├── aosp │ ├── frameworks │ │ └── base │ │ │ ├── core │ │ │ └── res │ │ │ │ └── res │ │ │ │ ├── values │ │ │ │ └── config.xml │ │ │ │ └── xml │ │ │ │ └── power_profile.xml │ │ │ └── packages │ │ │ ├── SettingsProvider │ │ │ └── res │ │ │ │ └── values │ │ │ │ └── defaults.xml │ │ │ └── SystemUI │ │ │ └── res │ │ │ └── values │ │ │ └── config.xml │ └── packages │ │ └── apps │ │ └── Settings │ │ └── res │ │ └── values │ │ ├── config.xml │ │ └── strings.xml └── lineage │ └── lineage-sdk │ └── lineage │ └── res │ └── res │ └── values │ └── config.xml ├── patches ├── apply-patches.sh ├── bootable │ └── recovery │ │ ├── 0001-pocket2-Fix-Items-to-Fit-on-Screen.patch │ │ └── 0002-pocket1-Use-Back-Button-As-Down.patch ├── build │ └── make │ │ └── core │ │ └── fix_atv_target.patch ├── frameworks │ └── base │ │ ├── 0001-Pocket2-Fix-Screenshots.patch │ │ ├── 0002-Use-Pre-Oreo-Power-Off-UI-and-add-Reboot-to-Recovery.patch │ │ └── 0003-Fix-Screen-Res-Wallpapers.patch ├── hardware │ └── interfaces │ │ └── 0001-Ignore-Usage-Bits-Warnings.patch ├── packages │ └── apps │ │ ├── Settings │ │ └── 0001-Remove-Encrypt-device-option-in-Settings.patch │ │ ├── SetupWizard │ │ └── 0001-Remove-Emergency-Call-Option.patch │ │ ├── Trebuchet │ │ ├── 0001-Allow-Trebuchet-and-Launcher3Go-to-coexist.patch │ │ └── 0002-Use-all-apps-button-in-Trebuchet.patch │ │ └── TvSettings │ │ └── add-reboot-to-recovery.patch └── remove-patches.sh ├── prebuilt ├── Android.mk ├── Launcher3Go │ ├── Android.mk │ └── Launcher3Go.apk ├── RePoLa │ └── Android.mk ├── RsMappingLite │ ├── Android.mk │ └── RsMappingLite.apk └── Toolbox │ ├── Android.mk │ └── Toolbox.apk ├── proprietary-files-vendor.txt ├── proprietary-files.txt ├── rootdir ├── Android.mk └── etc │ ├── factory_init.connectivity.rc │ ├── factory_init.project.rc │ ├── factory_init.rc │ ├── fstab.enableswap │ ├── fstab.mt6580 │ ├── init.ago.rc │ ├── init.connectivity.rc │ ├── init.modem.rc │ ├── init.mt6580.rc │ ├── init.mt6580.usb.rc │ ├── init.nvdata.rc │ ├── init.project.rc │ ├── init.sensor_1_0.rc │ ├── meta_init.connectivity.rc │ ├── meta_init.modem.rc │ ├── meta_init.project.rc │ ├── meta_init.rc │ ├── multi_init.rc │ ├── recovery.fstab │ └── ueventd.mt6580.rc ├── seccomp ├── mediacodec.policy └── mediaextractor.policy ├── sepolicy ├── file_contexts ├── pservice.te ├── service.te ├── service_contexts ├── startup.te └── untrusted_app.te ├── setup-makefiles.sh ├── system.prop ├── vendor.prop ├── vendorsetup.sh └── vndk ├── Android.mk └── vndk-sp-libs.mk /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | ifeq ($(TARGET_DEVICE),pocket2) 3 | include $(call all-makefiles-under,$(LOCAL_PATH)) 4 | include $(CLEAR_VARS) 5 | 6 | CACHE_MOUNT_POINT := $(TARGET_OUT_VENDOR)/cache 7 | NVDATA_MOUNT := $(TARGET_OUT_VENDOR)/nvdata 8 | PROTECT_F_MOUNT_POINT := $(TARGET_OUT_VENDOR)/protect_f 9 | PROTECT_S_MOUNT_POINT := $(TARGET_OUT_VENDOR)/protect_s 10 | PERSIST_MOUNT_POINT := $(TARGET_OUT_VENDOR)/persist 11 | 12 | $(CACHE_MOUNT_POINT): 13 | @echo "Creating $(CACHE_MOUNT_POINT)" 14 | @mkdir -p $(CACHE_MOUNT_POINT) 15 | 16 | $(NVDATA_MOUNT): 17 | @echo "Creating $(NVDATA_MOUNT)" 18 | @mkdir -p $(NVDATA_MOUNT) 19 | 20 | $(PROTECT_F_MOUNT_POINT): 21 | @echo "Creating $(PROTECT_F_MOUNT_POINT)" 22 | @mkdir -p $(PROTECT_F_MOUNT_POINT) 23 | 24 | $(PROTECT_S_MOUNT_POINT): 25 | @echo "Creating $(PROTECT_S_MOUNT_POINT)" 26 | @mkdir -p $(PROTECT_S_MOUNT_POINT) 27 | 28 | $(PERSIST_MOUNT_POINT): 29 | @echo "Creating $(PERSIST_MOUNT_POINT)" 30 | @mkdir -p $(PERSIST_MOUNT_POINT) 31 | 32 | ALL_DEFAULT_INSTALLED_MODULES += \ 33 | $(CACHE_MOUNT_POINT) $(NVDATA_MOUNT) $(PROTECT_F_MOUNT_POINT) $(PROTECT_S_MOUNT_POINT)\ 34 | $(PERSIST_MOUNT_POINT) 35 | 36 | KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ 37 | 38 | $(KERNEL_OUT): 39 | mkdir -p $(KERNEL_OUT) 40 | 41 | INSTALLED_KERNEL_HEADERS: $(KERNEL_OUT) 42 | 43 | endif 44 | 45 | -------------------------------------------------------------------------------- /AndroidProducts.mk: -------------------------------------------------------------------------------- 1 | PRODUCT_MAKEFILES := \ 2 | $(LOCAL_DIR)/aosp_pocket2.mk \ 3 | $(LOCAL_DIR)/lineage_pocket2.mk \ 4 | $(LOCAL_DIR)/lineage_atv_pocket2.mk 5 | -------------------------------------------------------------------------------- /BoardConfig.mk: -------------------------------------------------------------------------------- 1 | # Get proprietary blobs 2 | -include vendor/retroid/pocket2/BoardConfigVendor.mk 3 | 4 | DEVICE_PATH := device/retroid/pocket2 5 | 6 | # Architecture 7 | TARGET_BOARD_PLATFORM := mt6580 8 | 9 | TARGET_ARCH := arm 10 | TARGET_ARCH_VARIANT := armv7-a-neon 11 | TARGET_CPU_ABI := armeabi-v7a 12 | TARGET_CPU_ABI2 := armeabi 13 | TARGET_CPU_SMP := true 14 | TARGET_CPU_VARIANT := cortex-a7 15 | 16 | # Screen (For Bootanimation generation) 17 | TARGET_SCREEN_HEIGHT := 800 18 | TARGET_SCREEN_WIDTH := 640 19 | 20 | # Kernel 21 | TARGET_KERNEL_ARCH := arm 22 | TARGET_KERNEL_SOURCE := kernel/retroid/pocket2 23 | TARGET_KERNEL_CONFIG := gbx2000v1_defconfig 24 | BOARD_KERNEL_IMAGE_NAME := zImage-dtb 25 | TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(shell pwd)/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-eabi/bin/arm-eabi- 26 | BOARD_MKBOOTIMG_ARGS := --pagesize 2048 --base 0x80000000 --kernel_offset 0x00008000 --ramdisk_offset 0x04000000 --second_offset 0x00f00000 --tags_offset 0x0e000000 --cmdline "bootopt=64S3,32S1,32S1 androidboot.selinux=permissive" 27 | 28 | # Images 29 | TARGET_USERIMAGES_USE_EXT4 := true 30 | TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false 31 | BOARD_BOOTIMAGE_PARTITION_SIZE := 16777216 32 | BOARD_RECOVERYIMAGE_PARTITION_SIZE := 16777216 33 | BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1400831000 34 | BOARD_USERDATAIMAGE_PARTITION_SIZE := 5259657216 35 | BOARD_VENDORIMAGE_PARTITION_SIZE := 196607000 36 | BOARD_FLASH_BLOCK_SIZE := 131072 37 | 38 | # Build Vendor Image 39 | TARGET_COPY_OUT_VENDOR := vendor 40 | BOARD_USES_VENDORIMAGE := true 41 | BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 42 | 43 | # EGL 44 | USE_OPENGL_RENDERER := true 45 | TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true 46 | NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3 47 | TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK := false 48 | TARGET_USES_HWC2 := true 49 | TARGET_USES_HWC2ON1ADAPTER := false 50 | MTK_HWC_VERSION := 2.0.0 51 | MTK_SF_USE_PROCESSCALLSTACK := true 52 | MTK_GPU_VERSION := mali utgard r8p0-00dev0 53 | MTK_HWC_SUPPORT := yes 54 | 55 | # Wifi 56 | WPA_SUPPLICANT_VERSION := VER_0_8_X 57 | BOARD_HOSTAPD_DRIVER := NL80211 58 | BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_mt66xx 59 | BOARD_WPA_SUPPLICANT_DRIVER := NL80211 60 | BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_mt66xx 61 | WIFI_DRIVER_FW_PATH_PARAM:="/dev/wmtWifi" 62 | WIFI_DRIVER_FW_PATH_STA:=STA 63 | WIFI_DRIVER_FW_PATH_AP:=AP 64 | WIFI_DRIVER_FW_PATH_P2P:=P2P 65 | 66 | # MTK Hardware 67 | BOARD_HAS_MTK_HARDWARE := true 68 | BOARD_USES_MTK_HARDWARE := true 69 | MTK_HARDWARE := true 70 | 71 | # Charging 72 | BOARD_CHARGING_MODE_BOOTING_LPM := /sys/class/BOOT/BOOT/boot/boot_mode 73 | BACKLIGHT_PATH := /sys/class/leds/lcd-backlight/brightness 74 | BOARD_CHARGER_ENABLE_SUSPEND := true 75 | BOARD_CHARGER_SHOW_PERCENTAGE := true 76 | 77 | # Recovery resources 78 | TARGET_RECOVERY_FSTAB := device/retroid/pocket2/rootdir/etc/recovery.fstab 79 | TARGET_PREBUILT_RECOVERY_KERNEL := device/retroid/pocket2/kernel 80 | 81 | # Sepolicy 82 | BOARD_SEPOLICY_DIRS += \ 83 | device/retroid/pocket2/sepolicy 84 | 85 | # Bluetooth 86 | BOARD_HAVE_BLUETOOTH := true 87 | BOARD_HAVE_BLUETOOTH_MTK := true 88 | BOARD_BLUETOOTH_DOES_NOT_USE_RFKILL := true 89 | BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/retroid/pocket2/bluetooth 90 | 91 | # Bootanimation 92 | TARGET_BOOTANIMATION_MULTITHREAD_DECODE := true 93 | TARGET_BOOTANIMATION_PRELOAD := true 94 | TARGET_BOOTANIMATION_TEXTURE_CACHE := true 95 | 96 | # LineageOS Hardware 97 | BOARD_USES_LINEAGE_HARDWARE := true 98 | BOARD_HARDWARE_CLASS := $(DEVICE_PATH)/lineagehw 99 | 100 | # HIDL 101 | DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/configs/manifest.xml 102 | DEVICE_MATRIX_FILE := $(DEVICE_PATH)/configs/compatibility_matrix.xml 103 | 104 | # Seccomp policy 105 | BOARD_SECCOMP_POLICY := $(DEVICE_PATH)/seccomp 106 | 107 | # Headers 108 | TARGET_SPECIFIC_HEADER_PATH := $(DEVICE_PATH)/include 109 | 110 | # Gatekeeper 111 | BOARD_USE_SOFT_GATEKEEPER := true 112 | 113 | # Treble 114 | PRODUCT_FULL_TREBLE_OVERRIDE := true 115 | PRODUCT_VENDOR_MOVE_ENABLED := true 116 | PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE := 27 117 | BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true 118 | 119 | # MKE2FS 120 | TARGET_USES_MKE2FS := true 121 | 122 | # System Prop 123 | TARGET_SYSTEM_PROP += $(DEVICE_PATH)/system.prop 124 | 125 | # Vendor Prop 126 | TARGET_VENDOR_PROP += $(DEVICE_PATH)/vendor.prop 127 | 128 | # Exfat 129 | TARGET_EXFAT_DRIVER := exfat 130 | 131 | # Malloc_svelte 132 | MALLOC_SVELTE := true 133 | 134 | # Mediatek audio 135 | BOARD_USES_MTK_AUDIO := true 136 | USE_XML_AUDIO_POLICY_CONF := 1 137 | 138 | # AAPT CONFIG 139 | PRODUCT_AAPT_PREF_CONFIG := mdpi 140 | 141 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Experimental device tree for Retroid Pocket 2 LineageOS 15.1 2 | 3 | Issues: 4 | 5 | None that I'm aware of 6 | 7 | Note: Make sure to apply patches. Also, if you want LeanbackIME, clone it into packages/inputmethods/ from https://github.com/turtleletortue/LeanbackIME/ 8 | -------------------------------------------------------------------------------- /RemovePackages/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := RemovePackages 5 | LOCAL_MODULE_TAGS := optional 6 | LOCAL_MODULE_CLASS := APPS 7 | LOCAL_OVERRIDES_PACKAGES := AudioFX ExactCalculator Calendar Camera2 Email Messaging Phone Exchange2 Eleven Contacts Mms MmsService TelephonyProvider WAPPushManager TeleService Telecom init.lineage.atv.rc 8 | LOCAL_UNINSTALLABLE_MODULE := true 9 | LOCAL_CERTIFICATE := PRESIGNED 10 | include $(BUILD_PREBUILT) 11 | -------------------------------------------------------------------------------- /aosp_pocket2.mk: -------------------------------------------------------------------------------- 1 | # Call AOSP packages 2 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk) 3 | 4 | # Call device.mk (shared between CM/LineageOS & AOSP) 5 | $(call inherit-product, device/retroid/pocket2/device.mk) 6 | 7 | # Device branding for AOSP 8 | PRODUCT_BRAND := google 9 | PRODUCT_DEVICE := pocket2 10 | PRODUCT_MANUFACTURER := retroid 11 | PRODUCT_MODEL := Retroid Pocket 2 12 | PRODUCT_NAME := aosp_pocket2 13 | PRODUCT_RELEASE_NAME := RetroidPocket2 14 | 15 | -------------------------------------------------------------------------------- /bluetooth/bdroid_buildcfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BDROID_BUILDCFG_H 18 | #define _BDROID_BUILDCFG_H 19 | 20 | #define BTA_DISABLE_DELAY 1000 /* in milliseconds */ 21 | 22 | #define BTM_DEF_LOCAL_NAME "Retroid Pocket" 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /configs/compatibility_matrix.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.frameworks.schedulerservice 4 | 1.0 5 | 6 | 7 | android.frameworks.sensorservice 8 | 1.0 9 | 10 | 11 | android.hidl.allocator 12 | 1.0 13 | 14 | 15 | android.hidl.manager 16 | 1.0 17 | 18 | 19 | android.hidl.memory 20 | 1.0 21 | 22 | 23 | android.hidl.token 24 | 1.0 25 | 26 | 27 | android.system.wifi.keystore 28 | 1.0 29 | 30 | 31 | 0.0.0 32 | 33 | 34 | -------------------------------------------------------------------------------- /configs/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | android.hardware.audio 4 | hwbinder 5 | 2.0 6 | 7 | IDevicesFactory 8 | default 9 | 10 | 11 | 12 | android.hardware.audio.effect 13 | hwbinder 14 | 2.0 15 | 16 | IEffectsFactory 17 | default 18 | 19 | 20 | 21 | android.hardware.bluetooth 22 | hwbinder 23 | 1.0 24 | 25 | IBluetoothHci 26 | default 27 | 28 | 29 | 30 | android.hardware.broadcastradio 31 | hwbinder 32 | 1.0 33 | 34 | IBroadcastRadioFactory 35 | default 36 | 37 | 38 | 39 | android.hardware.cas 40 | hwbinder 41 | 1.0 42 | 43 | IMediaCasService 44 | default 45 | 46 | 47 | 48 | android.hardware.configstore 49 | hwbinder 50 | 1.0 51 | 52 | ISurfaceFlingerConfigs 53 | default 54 | 55 | 56 | 57 | android.hardware.drm 58 | hwbinder 59 | 1.0 60 | 61 | ICryptoFactory 62 | default 63 | widevine 64 | 65 | 66 | IDrmFactory 67 | default 68 | widevine 69 | 70 | 71 | 72 | android.hardware.gatekeeper 73 | hwbinder 74 | 1.0 75 | 76 | IGatekeeper 77 | default 78 | 79 | 80 | 81 | android.hardware.graphics.allocator 82 | hwbinder 83 | 2.0 84 | 85 | IAllocator 86 | default 87 | 88 | 89 | 90 | android.hardware.graphics.composer 91 | hwbinder 92 | 2.1 93 | 94 | IComposer 95 | default 96 | 97 | 98 | 99 | android.hardware.graphics.mapper 100 | passthrough 101 | 2.0 102 | 103 | IMapper 104 | default 105 | 106 | 107 | 108 | android.hardware.keymaster 109 | hwbinder 110 | 3.0 111 | 112 | IKeymasterDevice 113 | default 114 | 115 | 116 | 117 | android.hardware.light 118 | hwbinder 119 | 2.0 120 | 121 | ILight 122 | default 123 | 124 | 125 | 126 | android.hardware.media.omx 127 | hwbinder 128 | 1.0 129 | 130 | IOmx 131 | default 132 | 133 | 134 | IOmxStore 135 | default 136 | 137 | 138 | 139 | android.hardware.memtrack 140 | hwbinder 141 | 1.0 142 | 143 | IMemtrack 144 | default 145 | 146 | 147 | 148 | android.hardware.power 149 | hwbinder 150 | 1.0 151 | 152 | IPower 153 | default 154 | 155 | 156 | 157 | android.hardware.radio 158 | hwbinder 159 | 1.1 160 | 161 | IRadio 162 | imsrild1 163 | imsrild2 164 | slot1 165 | slot2 166 | 167 | 168 | ISap 169 | slot1 170 | slot2 171 | 172 | 173 | 174 | android.hardware.radio.deprecated 175 | hwbinder 176 | 1.0 177 | 178 | IOemHook 179 | slot1 180 | slot2 181 | 182 | 183 | 184 | android.hardware.renderscript 185 | passthrough 186 | 1.0 187 | 188 | IDevice 189 | default 190 | 191 | 192 | 193 | android.hardware.sensors 194 | hwbinder 195 | 1.0 196 | 197 | ISensors 198 | default 199 | 200 | 201 | 202 | android.hardware.thermal 203 | hwbinder 204 | 1.0 205 | 206 | IThermal 207 | default 208 | 209 | 210 | 211 | android.hardware.vibrator 212 | hwbinder 213 | 1.0 214 | 215 | IVibrator 216 | default 217 | 218 | 219 | 220 | android.hardware.wifi 221 | hwbinder 222 | 1.0 223 | 224 | IWifi 225 | default 226 | 227 | 228 | 229 | android.hardware.wifi.supplicant 230 | hwbinder 231 | 1.0 232 | 233 | ISupplicant 234 | default 235 | 236 | 237 | 238 | vendor.mediatek.hardware.imsa 239 | hwbinder 240 | 1.0 241 | 242 | IImsa 243 | imsa 244 | 245 | 246 | 247 | vendor.mediatek.hardware.keymaster_attestation 248 | hwbinder 249 | 1.0 250 | 251 | IKeymasterDevice 252 | default 253 | 254 | 255 | 256 | vendor.mediatek.hardware.mtkcodecservice 257 | hwbinder 258 | 1.1 259 | 260 | IMtkCodecService 261 | default 262 | 263 | 264 | 265 | vendor.mediatek.hardware.netdagent 266 | hwbinder 267 | 1.0 268 | 269 | INetdagent 270 | default 271 | 272 | 273 | 274 | vendor.mediatek.hardware.nvram 275 | hwbinder 276 | 1.0 277 | 278 | INvram 279 | default 280 | 281 | 282 | 283 | vendor.mediatek.hardware.power 284 | hwbinder 285 | 1.1 286 | 287 | IPower 288 | default 289 | 290 | 291 | 292 | vendor.mediatek.hardware.pq 293 | hwbinder 294 | 2.0 295 | 296 | IPictureQuality 297 | default 298 | 299 | 300 | 301 | vendor.mediatek.hardware.radio 302 | hwbinder 303 | 1.1 304 | 2.0 305 | 306 | IRadio 307 | imsrild1 308 | imsrild2 309 | slot1 310 | slot2 311 | 312 | 313 | ISap 314 | slot1 315 | slot2 316 | 317 | 318 | 319 | vendor.mediatek.hardware.radio.deprecated 320 | hwbinder 321 | 1.1 322 | 323 | IOemHook 324 | slot1 325 | slot2 326 | 327 | 328 | 329 | vendor.mediatek.hardware.radio_op 330 | hwbinder 331 | 1.1 332 | 333 | IRadioOp 334 | OpImsRILd1 335 | OpImsRILd2 336 | slot1 337 | slot2 338 | 339 | 340 | 341 | vendor.mediatek.hardware.radio_tc1 342 | hwbinder 343 | 1.1 344 | 345 | IRadio 346 | imsrild1 347 | imsrild2 348 | slot1 349 | slot2 350 | 351 | 352 | ISap 353 | slot1 354 | slot2 355 | 356 | 357 | 358 | vendor.mediatek.hardware.radio_tc1.deprecated 359 | hwbinder 360 | 1.1 361 | 362 | IOemHook 363 | slot1 364 | slot2 365 | 366 | 367 | 368 | vendor.mediatek.hardware.videotelephony 369 | hwbinder 370 | 1.0 371 | 372 | IVideoTelephony 373 | default 374 | 375 | 376 | 377 | vendor.mediatek.hardware.wfo 378 | hwbinder 379 | 1.0 380 | 381 | IWifiOffload 382 | wfo_hidl_service 383 | 384 | 385 | 386 | vendor.mediatek.hardware.wifi.hostapd 387 | hwbinder 388 | 1.0 389 | 390 | IHostapd 391 | default 392 | 393 | 394 | 395 | 27.0 396 | 397 | 398 | -------------------------------------------------------------------------------- /configs/wifi/p2p_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | p2p_no_group_iface=1 2 | driver_param=use_p2p_group_interface=1 3 | bss_expiration_scan_count=1 4 | wowlan_triggers=disconnect 5 | p2p_search_delay=50 6 | -------------------------------------------------------------------------------- /configs/wifi/wpa_supplicant.conf: -------------------------------------------------------------------------------- 1 | ctrl_interface=wlan0 2 | update_config=1 3 | manufacturer=MediaTek Inc. 4 | device_name=Wireless Client 5 | model_name=MTK Wireless Model 6 | model_number=1.0 7 | serial_number=2.0 8 | device_type=10-0050F204-5 9 | os_version=01020300 10 | config_methods=display push_button keypad 11 | p2p_no_group_iface=1 12 | driver_param=use_p2p_group_interface=1 13 | hs20=1 14 | -------------------------------------------------------------------------------- /configs/wifi/wpa_supplicant_overlay.conf: -------------------------------------------------------------------------------- 1 | p2p_no_group_iface=1 2 | driver_param=use_p2p_group_interface=1 3 | wowlan_triggers=disconnect 4 | p2p_disabled=1 5 | -------------------------------------------------------------------------------- /copy-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SYSDIR=$1 4 | if [ "x$SYSDIR" = "x" ]; then 5 | echo "You must specify system directory as first argument"; 6 | exit 7 | fi 8 | 9 | VENDOR=retroid 10 | DEVICE=pocket2 11 | 12 | BASE=../../../vendor/$VENDOR/$DEVICE/proprietary 13 | 14 | rm -rf $BASE/* 15 | 16 | for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do 17 | DIR=`dirname $FILE` 18 | if [ ! -d $BASE/$DIR ]; then 19 | mkdir -p $BASE/$DIR 20 | fi 21 | cp $SYSDIR/$FILE $BASE/$FILE 22 | done 23 | 24 | ./setup-makefiles.sh 25 | -------------------------------------------------------------------------------- /device-tablet.mk: -------------------------------------------------------------------------------- 1 | # Android stock launcher 2 | PRODUCT_PACKAGES += \ 3 | Launcher3Go 4 | 5 | # RePoLa (community, open source launcher) 6 | PRODUCT_PACKAGES += \ 7 | RePoLa 8 | 9 | # LeanbackIME (Android TV keyboard, from Android 11) 10 | PRODUCT_PACKAGES += \ 11 | LeanbackIME 12 | 13 | PRODUCT_PROPERTY_OVERRIDES += \ 14 | ro.sf.lcd_density=186 15 | 16 | # Tablet characteristics 17 | PRODUCT_CHARACTERISTICS := tablet 18 | 19 | -------------------------------------------------------------------------------- /device.mk: -------------------------------------------------------------------------------- 1 | # Android Go defaults 2 | $(call inherit-product, $(SRC_TARGET_DIR)/product/go_defaults.mk) 3 | 4 | # Launched with 8.1 5 | $(call inherit-product, $(SRC_TARGET_DIR)/product/product_launched_with_o_mr1.mk) 6 | 7 | # Add all product locales 8 | $(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk) 9 | 10 | # Vendor 11 | $(call inherit-product-if-exists, vendor/retroid/pocket2/pocket2-vendor.mk) 12 | 13 | # Turtle extras 14 | $(call inherit-product-if-exists, vendor/turtle/extras/turtle-vendor.mk) 15 | 16 | # Hidl 17 | include $(LOCAL_PATH)/hidl.mk 18 | 19 | # Wifi 20 | PRODUCT_PACKAGES += \ 21 | libwpa_client \ 22 | hostapd \ 23 | dhcpcd.conf \ 24 | wpa_supplicant \ 25 | wpa_supplicant.conf \ 26 | lib_driver_cmd_mt66xx \ 27 | libwifi-hal-mt66xx 28 | 29 | # Audio 30 | PRODUCT_PACKAGES += \ 31 | audio.primary.mt6580 \ 32 | audio_policy.default \ 33 | audio.a2dp.default \ 34 | audio.usb.default \ 35 | audio.r_submix.default \ 36 | libaudio-resampler \ 37 | libaudioroute \ 38 | libtinyalsa \ 39 | libalsautils \ 40 | libtinycompress \ 41 | libtinyxml \ 42 | tinymix \ 43 | tinypcminfo \ 44 | tinycap \ 45 | tinyplay 46 | 47 | # Bluetooth 48 | PRODUCT_PACKAGES += libbt-vendor 49 | 50 | # etc 51 | PRODUCT_PACKAGES += \ 52 | netutils-wrapper-1.0 \ 53 | librs_jni \ 54 | libnl_2 55 | 56 | # Init files 57 | PRODUCT_PACKAGES += \ 58 | init.connectivity.rc \ 59 | init.modem.rc \ 60 | init.mt6580.rc \ 61 | init.project.rc \ 62 | init.sensor_1_0.rc \ 63 | multi_init.rc \ 64 | fstab.mt6580 \ 65 | ueventd.mt6580.rc \ 66 | init.mt6580.usb.rc \ 67 | init.nvdata.rc \ 68 | fstab.enableswap 69 | 70 | # Graphics 71 | PRODUCT_PACKAGES += \ 72 | libGLES_android \ 73 | libion 74 | 75 | # Retroid Apps 76 | PRODUCT_PACKAGES += \ 77 | Toolbox \ 78 | RsMappingLite 79 | 80 | # VNDK-SP 81 | PRODUCT_PACKAGES += \ 82 | vndk-sp 83 | 84 | PRODUCT_PACKAGES += \ 85 | libnbaio_mono 86 | 87 | # DRM 88 | PRODUCT_PACKAGES += \ 89 | libdrm \ 90 | libmockdrmcryptoplugin 91 | 92 | # Default default.prop properties 93 | PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \ 94 | ro.config.low_ram=true \ 95 | ro.mount.fs=EXT4 \ 96 | persist.service.acm.enable=0 \ 97 | ro.hwui.disable_asset_atlas=true \ 98 | ro.mtk_perf_fast_start_win=0 \ 99 | persist.service.acm.enable=0 \ 100 | debug.atrace.tags.enableflags=0 \ 101 | ro.hwui.path_cache_size=0 \ 102 | ro.hwui.text_small_cache_width=512 \ 103 | ro.hwui.text_small_cache_height=256 \ 104 | camera.disable_zsl_mode=1 105 | 106 | # Permissions 107 | PRODUCT_COPY_FILES += \ 108 | frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \ 109 | frameworks/native/data/etc/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml \ 110 | frameworks/native/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \ 111 | frameworks/native/data/etc/android.hardware.camera.xml:system/etc/permissions/android.hardware.camera.xml \ 112 | frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \ 113 | frameworks/native/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \ 114 | frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \ 115 | frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \ 116 | frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \ 117 | frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml \ 118 | frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \ 119 | frameworks/native/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \ 120 | frameworks/native/data/etc/tablet_core_hardware.xml:system/etc/permissions/tablet_core_hardware.xml 121 | 122 | # Seccomp 123 | PRODUCT_COPY_FILES += \ 124 | $(LOCAL_PATH)/seccomp/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \ 125 | $(LOCAL_PATH)/seccomp/mediaextractor.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaextractor.policy \ 126 | 127 | # WiFi 128 | PRODUCT_COPY_FILES += \ 129 | $(LOCAL_PATH)/configs/wifi/p2p_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant_overlay.conf \ 130 | $(LOCAL_PATH)/configs/wifi/wpa_supplicant.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant.conf \ 131 | $(LOCAL_PATH)/configs/wifi/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf \ 132 | 133 | PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0 134 | 135 | # Overlay 136 | DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay/aosp 137 | 138 | # MTKRC 139 | PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.mtkrc.path=/vendor/etc/init/hw/ 140 | 141 | # Dalvik/HWUI 142 | $(call inherit-product, frameworks/native/build/tablet-7in-hdpi-1024-dalvik-heap.mk) 143 | $(call inherit-product-if-exists, frameworks/native/build/phone-xxhdpi-2048-hwui-memory.mk) 144 | -------------------------------------------------------------------------------- /extract-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2018 The LineageOS Project 3 | 4 | set -e 5 | 6 | DEVICE=pocket2 7 | VENDOR=retroid 8 | 9 | # Load extractutils and do some sanity checks 10 | MY_DIR="${BASH_SOURCE%/*}" 11 | if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi 12 | 13 | LINEAGE_ROOT="$MY_DIR"/../../.. 14 | 15 | HELPER="$LINEAGE_ROOT"/vendor/lineage/build/tools/extract_utils.sh 16 | if [ ! -f "$HELPER" ]; then 17 | echo "Unable to find helper script at $HELPER" 18 | exit 1 19 | fi 20 | . "$HELPER" 21 | 22 | # Default to sanitizing the vendor folder before extraction 23 | CLEAN_VENDOR=true 24 | 25 | while [ "$1" != "" ]; do 26 | case $1 in 27 | -n | --no-cleanup ) CLEAN_VENDOR=false 28 | ;; 29 | -s | --section ) shift 30 | SECTION=$1 31 | CLEAN_VENDOR=false 32 | ;; 33 | * ) SRC=$1 34 | ;; 35 | esac 36 | shift 37 | done 38 | 39 | if [ -z "$SRC" ]; then 40 | SRC=adb 41 | fi 42 | 43 | # Initialize the helper 44 | setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" false "$CLEAN_VENDOR" 45 | 46 | extract "$MY_DIR"/proprietary-files.txt "$SRC" 47 | #extract "$MY_DIR"/proprietary-files-vndk.txt "$SRC" 48 | extract "$MY_DIR"/proprietary-files-vendor.txt "$SRC" 49 | 50 | "$MY_DIR"/setup-makefiles.sh 51 | -------------------------------------------------------------------------------- /hidl.mk: -------------------------------------------------------------------------------- 1 | # HIDL 2 | PRODUCT_PACKAGES += \ 3 | android.hidl.base@1.0 \ 4 | android.hidl.manager@1.0 5 | 6 | # Power (non-lineage imp) 7 | #PRODUCT_PACKAGES += android.hardware.power@1.0-impl 8 | 9 | # Graphics 10 | PRODUCT_PACKAGES += \ 11 | android.hardware.graphics.allocator@2.0-impl \ 12 | android.hardware.graphics.mapper@2.0-impl \ 13 | android.hardware.renderscript@1.0-impl \ 14 | android.hardware.graphics.composer@2.1-impl \ 15 | android.hardware.graphics.composer@2.1-service 16 | 17 | # Gatekeeper HIDL 18 | PRODUCT_PACKAGES += \ 19 | android.hardware.gatekeeper@1.0-impl \ 20 | android.hardware.gatekeeper@1.0-service 21 | 22 | # Bluetooth - Use mtk version instead 23 | #PRODUCT_PACKAGES += \ 24 | # android.hardware.bluetooth@1.0-impl \ 25 | # android.hardware.bluetooth@1.0-service 26 | 27 | # Audio HAL 28 | PRODUCT_PACKAGES += \ 29 | android.hardware.audio.effect@2.0-impl \ 30 | 31 | # android.hardware.audio@2.0-impl \ 32 | # android.hardware.audio@2.0-service 33 | 34 | # Keymaster HIDL 35 | PRODUCT_PACKAGES += \ 36 | android.hardware.keymaster@3.0-impl \ 37 | android.hardware.keymaster@3.0-service 38 | 39 | # Vibrator 40 | PRODUCT_PACKAGES += \ 41 | android.hardware.vibrator@1.0-impl 42 | 43 | # Lights - use mtk impl 44 | #PRODUCT_PACKAGES += \ 45 | # android.hardware.light@2.0-impl 46 | 47 | # Sensors - use mtk impl 48 | #PRODUCT_PACKAGES += \ 49 | # android.hardware.sensors@1.0-impl 50 | 51 | # Thermal 52 | PRODUCT_PACKAGES += \ 53 | android.hardware.thermal@1.0-impl 54 | #android.hardware.thermal@1.0-service 55 | 56 | # Camera 57 | #PRODUCT_PACKAGES += \ 58 | # android.hardware.camera.provider@2.4-service \ 59 | # android.hardware.camera.provider@2.4-impl 60 | 61 | # Memtrack 62 | PRODUCT_PACKAGES += \ 63 | android.hardware.memtrack@1.0-impl 64 | 65 | # DRM 66 | PRODUCT_PACKAGES += \ 67 | android.hardware.drm@1.0-impl 68 | 69 | # wifi 70 | PRODUCT_PACKAGES += \ 71 | android.hardware.wifi@1.0-impl \ 72 | android.hardware.wifi@1.0-service 73 | 74 | # Broadcastradio 75 | #PRODUCT_PACKAGES += \ 76 | # android.hardware.broadcastradio@1.1-impl \ 77 | # android.hardware.broadcastradio@1.1-service 78 | 79 | # USB 80 | #PRODUCT_PACKAGES += \ 81 | # android.hardware.usb@1.0 \ 82 | # android.hardware.usb@1.0-service.basic \ 83 | # android.hardware.usb.gadget@1.0-impl \ 84 | # android.hardware.usb.gadget@1.0-service 85 | 86 | -------------------------------------------------------------------------------- /include/fd_utils-inl-extra.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The CyanogenMod Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define PATH_WHITELIST_EXTRA_H \ 18 | "/proc/ged", 19 | 20 | // Overload this file in your device specific config if you need 21 | // to add extra whitelisted paths. 22 | // WARNING: Only use this if necessary. Custom inits should be 23 | // checked for leaked file descriptors before even considering 24 | // this. 25 | // In order to add your files, copy the whole file (don't forget the copyright notice!), 26 | // uncomment the #define above and change the paths inside to match your requirements 27 | 28 | 29 | -------------------------------------------------------------------------------- /kernel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turtleletortue/android_device_retroid_pocket2/6a2dbe6df72434a3ae7a0f2bc9c6f538a2e5081e/kernel -------------------------------------------------------------------------------- /lineage.dependencies: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "repository": "android_device_lineage_atv", 4 | "target_path": "device/lineage/atv" 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /lineage_atv_pocket2.mk: -------------------------------------------------------------------------------- 1 | # Call Android TV packages 2 | $(call inherit-product, device/google/atv/products/atv_base.mk) 3 | 4 | # Call device.mk (shared between CM/LineageOS & AOSP) 5 | $(call inherit-product, device/retroid/pocket2/device.mk) 6 | 7 | # Call Lineage TV configs 8 | $(call inherit-product, vendor/lineage/config/common_full_tv.mk) 9 | 10 | # Call Lineage ATV configs 11 | $(call inherit-product, device/lineage/atv/lineage_atv.mk) 12 | 13 | # Device branding for AOSP 14 | PRODUCT_BRAND := google 15 | PRODUCT_DEVICE := pocket2 16 | PRODUCT_MANUFACTURER := retroid 17 | PRODUCT_MODEL := Retroid Pocket 2 18 | PRODUCT_NAME := lineage_atv_pocket2 19 | PRODUCT_RELEASE_NAME := RetroidPocket2 20 | 21 | # Lineage Overlay 22 | DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay/lineage 23 | 24 | # Remove extra apps 25 | PRODUCT_PACKAGES += RemovePackages 26 | 27 | PRODUCT_PROPERTY_OVERRIDES += \ 28 | ro.sf.lcd_density=140 \ 29 | lineage.updater.uri=https://raw.githubusercontent.com/turtleletortue/OTA/15.1/15.1_atv_pocket2.json 30 | 31 | # Tablet characteristics 32 | PRODUCT_CHARACTERISTICS := tv 33 | 34 | -------------------------------------------------------------------------------- /lineage_pocket2.mk: -------------------------------------------------------------------------------- 1 | # Call AOSP packages 2 | $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk) 3 | 4 | # Call device.mk (shared between CM/LineageOS & AOSP) 5 | $(call inherit-product, device/retroid/pocket2/device.mk) 6 | 7 | # Call device-tablet.mk (Used for non-ATV builds) 8 | $(call inherit-product, device/retroid/pocket2/device-tablet.mk) 9 | 10 | # Turtle extras 11 | $(call inherit-product-if-exists, vendor/turtle/pocket2.mk) 12 | 13 | # Call tablet config 14 | $(call inherit-product, vendor/lineage/config/common_full_tablet_wifionly.mk) 15 | 16 | # Device branding for AOSP 17 | PRODUCT_BRAND := google 18 | PRODUCT_DEVICE := pocket2 19 | PRODUCT_MANUFACTURER := retroid 20 | PRODUCT_MODEL := Retroid Pocket 2 21 | PRODUCT_NAME := lineage_pocket2 22 | PRODUCT_RELEASE_NAME := RetroidPocket2 23 | 24 | # Lineage Overlay 25 | DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay/lineage 26 | 27 | # Remove extra apps 28 | PRODUCT_PACKAGES += RemovePackages 29 | 30 | -------------------------------------------------------------------------------- /lineagehw/org/lineageos/hardware/DisplayColorCalibration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 The CyanogenMod Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.lineageos.hardware; 18 | 19 | import java.util.Scanner; 20 | import org.lineageos.internal.util.FileUtils; 21 | 22 | public class DisplayColorCalibration { 23 | private static final String COLOR_FILE = "/sys/devices/platform/mtk_disp_mgr.0/rgb"; 24 | 25 | public static boolean isSupported() { 26 | return FileUtils.isFileWritable(COLOR_FILE); 27 | } 28 | 29 | public static int getMaxValue() { 30 | return 2000; 31 | } 32 | 33 | public static int getMinValue() { 34 | return 0; 35 | } 36 | 37 | public static int getDefValue() { 38 | return getMaxValue(); 39 | } 40 | 41 | public static String getCurColors() { 42 | return FileUtils.readOneLine(COLOR_FILE); 43 | } 44 | 45 | public static boolean setColors(String colors) { 46 | return FileUtils.writeLine(COLOR_FILE, colors); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /mtk/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) -------------------------------------------------------------------------------- /mtk/lib_driver_cmd_mt66xx/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | ################################################################################### 17 | ##### This Makefile include Google pure SUPPLICANT and MTK Turnkey SUPPLICANT ##### 18 | ################################################################################### 19 | LOCAL_PATH := $(call my-dir) 20 | 21 | ##### For Google SUPPLICANT ##### 22 | ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_8_X) 23 | 24 | WPA_SUPPL_DIR = external/wpa_supplicant_8 25 | WPA_SRC_FILE := 26 | 27 | ifneq ($(BOARD_WPA_SUPPLICANT_DRIVER),) 28 | CONFIG_DRIVER_$(BOARD_WPA_SUPPLICANT_DRIVER) := y 29 | endif 30 | ifneq ($(BOARD_HOSTAPD_DRIVER),) 31 | CONFIG_DRIVER_$(BOARD_HOSTAPD_DRIVER) := y 32 | endif 33 | 34 | include $(WPA_SUPPL_DIR)/wpa_supplicant/android.config 35 | 36 | WPA_SUPPL_DIR_INCLUDE = $(WPA_SUPPL_DIR)/src \ 37 | $(WPA_SUPPL_DIR)/src/common \ 38 | $(WPA_SUPPL_DIR)/src/drivers \ 39 | $(WPA_SUPPL_DIR)/src/l2_packet \ 40 | $(WPA_SUPPL_DIR)/src/utils \ 41 | $(WPA_SUPPL_DIR)/src/wps \ 42 | $(WPA_SUPPL_DIR)/wpa_supplicant 43 | 44 | ifdef CONFIG_DRIVER_NL80211 45 | WPA_SUPPL_DIR_INCLUDE += external/libnl/include 46 | WPA_SRC_FILE += mediatek_driver_cmd_nl80211.c 47 | endif 48 | 49 | ifdef CONFIG_DRIVER_WEXT 50 | #error doesn't support CONFIG_DRIVER_WEXT 51 | endif 52 | 53 | # To force sizeof(enum) = 4 54 | ifeq ($(TARGET_ARCH),arm) 55 | L_CFLAGS += -mabi=aapcs-linux 56 | endif 57 | 58 | ifdef CONFIG_ANDROID_LOG 59 | L_CFLAGS += -DCONFIG_ANDROID_LOG 60 | endif 61 | 62 | ######################## 63 | 64 | include $(CLEAR_VARS) 65 | LOCAL_MODULE := lib_driver_cmd_mt66xx 66 | LOCAL_PROPRIETARY_MODULE := true 67 | LOCAL_SHARED_LIBRARIES := libc libcutils 68 | LOCAL_CFLAGS := $(L_CFLAGS) 69 | LOCAL_SRC_FILES := $(WPA_SRC_FILE) 70 | LOCAL_C_INCLUDES := $(WPA_SUPPL_DIR_INCLUDE) 71 | include $(BUILD_STATIC_LIBRARY) 72 | 73 | ######################## 74 | 75 | endif 76 | -------------------------------------------------------------------------------- /mtk/lib_driver_cmd_mt66xx/README: -------------------------------------------------------------------------------- 1 | This directory contains WIFI wpa_supplicant third party library lib_driver_cmd_mt66xx.a 2 | 3 | 4 | WHAT IT DOES? 5 | ============= 6 | It provide WIFI third party library for WIFI wpa_supplicant usage. 7 | 8 | 9 | HOW IT WAS BUILT? 10 | ================== 11 | It needs the following libs from AOSP: 12 | 13 | 14 | and the following libs from MediaTek: 15 | 16 | 17 | All source/dependency modules of this module are already put in 18 | 'hardware/mediatek/wlan/wpa_supplicant_8' folder. 19 | 20 | 21 | HOW TO USE IT? 22 | ============== 23 | Files in this directory is used for wpa_supplicant_8 24 | 25 | 26 | All the source code of this directory were written by MediaTek co.. 27 | 28 | -------------------------------------------------------------------------------- /mtk/lib_driver_cmd_mt66xx/mediatek_driver_nl80211.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Driver interaction with Linux nl80211/cfg80211 3 | * Copyright (c) 2002-2010, Jouni Malinen 4 | * Copyright (c) 2003-2004, Instant802 Networks, Inc. 5 | * Copyright (c) 2005-2006, Devicescape Software, Inc. 6 | * Copyright (c) 2007, Johannes Berg 7 | * Copyright (c) 2009-2010, Atheros Communications 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License version 2 as 11 | * published by the Free Software Foundation. 12 | * 13 | * Alternatively, this software may be distributed under the terms of BSD 14 | * license. 15 | * 16 | * See README and COPYING for more details. 17 | */ 18 | 19 | #ifndef _MTK_DRIVER_NL80211_H_ 20 | #define _MTK_DRIVER_NL80211_H_ 21 | 22 | 23 | #ifndef BITS 24 | /* Eddie */ 25 | /* bits range: for example BITS(16,23) = 0xFF0000 26 | * ==> (BIT(m)-1) = 0x0000FFFF ~(BIT(m)-1) => 0xFFFF0000 27 | * ==> (BIT(n+1)-1) = 0x00FFFFFF 28 | */ 29 | #define BITS(m,n) (~(BIT(m)-1) & ((BIT(n) - 1) | BIT(n))) 30 | #endif /* BIT */ 31 | 32 | 33 | enum nl80211_testmode_sta_link_statistics_attr{ 34 | __NL80211_TESTMODE_STA_STATISTICS_INVALID = 0, 35 | NL80211_TESTMODE_STA_STATISTICS_VERSION, 36 | NL80211_TESTMODE_STA_STATISTICS_MAC, 37 | NL80211_TESTMODE_STA_STATISTICS_LINK_SCORE, 38 | NL80211_TESTMODE_STA_STATISTICS_FLAG, 39 | 40 | NL80211_TESTMODE_STA_STATISTICS_PER, 41 | NL80211_TESTMODE_STA_STATISTICS_RSSI, 42 | NL80211_TESTMODE_STA_STATISTICS_PHY_MODE, 43 | NL80211_TESTMODE_STA_STATISTICS_TX_RATE, 44 | 45 | NL80211_TESTMODE_STA_STATISTICS_TOTAL_CNT, 46 | NL80211_TESTMODE_STA_STATISTICS_THRESHOLD_CNT, 47 | 48 | NL80211_TESTMODE_STA_STATISTICS_AVG_PROCESS_TIME, 49 | NL80211_TESTMODE_STA_STATISTICS_MAX_PROCESS_TIME, 50 | NL80211_TESTMODE_STA_STATISTICS_AVG_HIF_PROCESS_TIME, 51 | NL80211_TESTMODE_STA_STATISTICS_MAX_HIF_PROCESS_TIME, 52 | 53 | 54 | NL80211_TESTMODE_STA_STATISTICS_FAIL_CNT, 55 | NL80211_TESTMODE_STA_STATISTICS_TIMEOUT_CNT, 56 | NL80211_TESTMODE_STA_STATISTICS_AVG_AIR_TIME, 57 | 58 | NL80211_TESTMODE_STA_STATISTICS_TC_EMPTY_CNT_ARRAY, 59 | NL80211_TESTMODE_STA_STATISTICS_TC_QUE_LEN_ARRAY, 60 | 61 | NL80211_TESTMODE_STA_STATISTICS_TC_AVG_QUE_LEN_ARRAY, 62 | NL80211_TESTMODE_STA_STATISTICS_TC_CUR_QUE_LEN_ARRAY, 63 | 64 | /* 65 | * how many packages TX during statistics interval 66 | */ 67 | NL80211_TESTMODE_STA_STATISTICS_ENQUEUE, 68 | 69 | /* 70 | * how many packages TX during statistics interval 71 | */ 72 | NL80211_TESTMODE_STA_STATISTICS_STA_ENQUEUE, 73 | 74 | /* 75 | * how many packages dequeue during statistics interval 76 | */ 77 | NL80211_TESTMODE_STA_STATISTICS_DEQUEUE, 78 | 79 | /* 80 | * how many packages dequeue during statistics interval 81 | */ 82 | NL80211_TESTMODE_STA_STATISTICS_STA_DEQUEUE, 83 | 84 | /* 85 | * how many TC[0-3] resource back from firmware during 86 | * statistics interval 87 | */ 88 | NL80211_TESTMODE_STA_STATISTICS_RB_ARRAY, 89 | NL80211_TESTMODE_STA_STATISTICS_NO_TC_ARRAY, 90 | NL80211_TESTMODE_STA_STATISTICS_TC_USED_ARRAY, 91 | NL80211_TESTMODE_STA_STATISTICS_TC_WANTED_ARRAY, 92 | 93 | NL80211_TESTMODE_STA_STATISTICS_IRQ_ISR_CNT, 94 | NL80211_TESTMODE_STA_STATISTICS_IRQ_ISR_PASS_CNT, 95 | NL80211_TESTMODE_STA_STATISTICS_IRQ_TASK_CNT, 96 | NL80211_TESTMODE_STA_STATISTICS_IRQ_AB_CNT, 97 | NL80211_TESTMODE_STA_STATISTICS_IRQ_SW_CNT, 98 | NL80211_TESTMODE_STA_STATISTICS_IRQ_TX_CNT, 99 | NL80211_TESTMODE_STA_STATISTICS_IRQ_RX_CNT, 100 | 101 | NL80211_TESTMODE_STA_STATISTICS_RESERVED_ARRAY, 102 | 103 | NL80211_TESTMODE_STA_STATISTICS_NUM, 104 | NL80211_TESTMODE_STA_STATISTICS_MAX = NL80211_TESTMODE_STA_STATISTICS_NUM - 1 105 | }; 106 | 107 | enum nl80211_testmode_link_detect_attr{ 108 | NL80211_TESTMODE_LINK_INVALID = 0, 109 | NL80211_TESTMODE_LINK_TX_FAIL_CNT, 110 | NL80211_TESTMODE_LINK_TX_RETRY_CNT, 111 | NL80211_TESTMODE_LINK_TX_MULTI_RETRY_CNT, 112 | NL80211_TESTMODE_LINK_ACK_FAIL_CNT, 113 | NL80211_TESTMODE_LINK_FCS_ERR_CNT, 114 | NL80211_TESTMODE_LINK_TX_OK_CNT, 115 | NL80211_TESTMODE_LINK_RX_OK_CNT, 116 | NL80211_TESTMODE_LINK_RST_REASON, 117 | NL80211_TESTMODE_LINK_RST_TIME, 118 | NL80211_TESTMODE_LINK_ROAM_FAIL_TIMES, 119 | NL80211_TESTMODE_LINK_ROAM_FAIL_TIME, 120 | NL80211_TESTMODE_LINK_TX_DONE_DELAY_IS_ARP, 121 | NL80211_TESTMODE_LINK_ARRIVE_DRV_TICK, 122 | NL80211_TESTMODE_LINK_ENQUE_TICK, 123 | NL80211_TESTMODE_LINK_DEQUE_TICK, 124 | NL80211_TESTMODE_LINK_LEAVE_DRV_TICK, 125 | NL80211_TESTMODE_LINK_CURR_TICK, 126 | NL80211_TESTMODE_LINK_CURR_TIME, 127 | NL80211_TESTMODE_LINK_DETECT_NUM, 128 | NL80211_TESTMODE_LINK_DETECT_MAX = NL80211_TESTMODE_LINK_DETECT_NUM - 1 129 | }; 130 | 131 | #define BUG_REPORT_NUM 47 132 | 133 | typedef enum _ENUM_TRAFFIC_CLASS_INDEX_T { 134 | TC0_INDEX = 0, 135 | TC1_INDEX, 136 | TC2_INDEX, 137 | TC3_INDEX, 138 | TC_DATA_NUM, 139 | TC4_INDEX = TC_DATA_NUM, 140 | TC5_INDEX, 141 | TC_NUM 142 | } ENUM_TRAFFIC_CLASS_INDEX_T; 143 | 144 | struct wpa_driver_sta_statistics_s { 145 | u8 version; 146 | u8 addr[ETH_ALEN]; 147 | u32 flag; 148 | 149 | u32 link_score; 150 | u8 per; 151 | int rssi; 152 | u32 phy_mode; 153 | double tx_rate; 154 | 155 | u32 tx_total_cnt; 156 | u32 enqueue_total_cnt; 157 | u32 dequeue_total_cnt; 158 | u32 enqueue_sta_total_cnt; 159 | u32 dequeue_sta_total_cnt; 160 | u32 tx_exc_threshold_cnt; 161 | 162 | u32 tx_avg_process_time; 163 | u32 tx_max_process_time; 164 | u32 tx_avg_hif_process_time; 165 | u32 tx_max_hif_process_time; 166 | 167 | u32 tx_fail_cnt; 168 | u32 tx_timeout_cnt; 169 | u32 tx_avg_air_time; 170 | 171 | u32 tc_buf_full_cnt[TC_DATA_NUM]; 172 | u32 tc_que_len[TC_DATA_NUM]; 173 | 174 | /* 175 | * how many TC[0-3] resource back from firmware during 176 | * statistics intervals 177 | */ 178 | u32 tc_back_count[TC_DATA_NUM]; 179 | 180 | /* 181 | * how many times that no TC[0-3] resource when dequeue 182 | * statistics intervals 183 | */ 184 | u32 dequeue_no_tc_res[TC_DATA_NUM]; 185 | u32 tc_wanted_res[TC_DATA_NUM]; 186 | u32 tc_used_res[TC_DATA_NUM]; 187 | 188 | /* 189 | * wlan interrupt info 190 | * statistics intervals 191 | */ 192 | u32 isr_cnt; 193 | u32 isr_pass_cnt; 194 | u32 isr_task_cnt; 195 | u32 isr_ab_cnt; 196 | u32 isr_sw_cnt; 197 | u32 isr_tx_cnt; 198 | u32 isr_rx_cnt; 199 | 200 | u32 tc_avg_que_len[TC_DATA_NUM]; 201 | u32 tc_cur_que_len[TC_DATA_NUM]; 202 | 203 | u8 reserved[32]; 204 | }; 205 | 206 | struct wpa_driver_sta_link_detect_s { 207 | u64 tx_fail_cnt; 208 | u64 tx_retry_cnt; 209 | u64 tx_multi_retry_cnt; 210 | u64 ack_fail_cnt; 211 | u64 fcs_err_cnt; 212 | u64 tx_ok_cnt; 213 | u64 rx_ok_cnt; 214 | u32 rst_reason; 215 | u64 rst_time; 216 | u32 roam_fail_times; 217 | u64 roam_fail_time; 218 | u8 tx_done_delay_is_arp; 219 | u32 arrive_drv_tick; 220 | u32 en_que_tick; 221 | u32 de_que_tick; 222 | u32 leave_drv_tick; 223 | u32 curr_tick; 224 | u64 curr_time; 225 | u32 bug_report[BUG_REPORT_NUM]; 226 | }; 227 | 228 | /* SIOCSIWENCODEEXT definitions */ 229 | #define IW_ENCODE_ALG_SMS4 0x20 230 | 231 | /* P2P Sigma*/ 232 | struct wpa_driver_test_mode_info { 233 | u32 index; 234 | u32 buflen; 235 | }; 236 | 237 | struct wpa_driver_testmode_params { 238 | struct wpa_driver_test_mode_info hdr; 239 | u8 *buf; 240 | }; 241 | 242 | struct wpa_driver_get_sta_statistics_params { 243 | struct wpa_driver_test_mode_info hdr; 244 | u32 version; 245 | u32 flag; 246 | u8 addr[ETH_ALEN]; 247 | u8 *buf; 248 | }; 249 | 250 | struct wpa_driver_p2p_sigma_params { 251 | struct wpa_driver_test_mode_info hdr; 252 | u32 idx; 253 | u32 value; 254 | }; 255 | 256 | struct wpa_driver_get_sta_link_detect_params { 257 | struct wpa_driver_test_mode_info hdr; 258 | u8 *buf; 259 | }; 260 | 261 | /* Hotspot Client Management */ 262 | struct wpa_driver_hotspot_params { 263 | struct wpa_driver_test_mode_info hdr; 264 | u8 blocked; 265 | u8 bssid[ETH_ALEN]; 266 | }; 267 | 268 | struct wpa_driver_hotspot_set_config_params { 269 | struct wpa_driver_test_mode_info hdr; 270 | u32 index; 271 | u32 value; 272 | }; 273 | 274 | #ifdef CONFIG_MTK_LTE_COEX 275 | enum nl80211_testmode_available_chan_attr{ 276 | __NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_INVALID, 277 | NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_2G_BASE_1, 278 | NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_5G_BASE_36, 279 | NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_5G_BASE_52, 280 | NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_5G_BASE_100, 281 | NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_5G_BASE_149, 282 | 283 | __NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_AFTER_LAST, 284 | NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_MAX = __NL80211_TESTMODE_AVAILABLE_CHAN_ATTR_AFTER_LAST - 1 285 | }; 286 | 287 | struct wpa_driver_available_chan_s { 288 | u32 ch_2g_base1; 289 | u32 ch_5g_base36; 290 | u32 ch_5g_base52; 291 | u32 ch_5g_base100; 292 | u32 ch_5g_base149; 293 | }; 294 | 295 | struct wpa_driver_get_available_channel_params { 296 | struct wpa_driver_test_mode_info hdr; 297 | u8 *buf; 298 | }; 299 | #endif 300 | 301 | /* SW CMD */ 302 | struct wpa_driver_sw_cmd_params { 303 | struct wpa_driver_test_mode_info hdr; 304 | u8 set; 305 | u32 adr; 306 | u32 data; 307 | }; 308 | 309 | struct wpa_driver_suspendmode_params { 310 | struct wpa_driver_test_mode_info hdr; 311 | u8 suspend; 312 | }; 313 | 314 | /* WAPI */ 315 | struct iw_encode_exts { 316 | u32 ext_flags; /* IW_ENCODE_EXT_* */ 317 | u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ 318 | u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ 319 | u8 addr[ETH_ALEN]; /* ff:ff:ff:ff:ff:ff for broadcast/multicast 320 | * (group) keys or unicast address for 321 | * individual keys */ 322 | u16 alg; /* IW_ENCODE_ALG_* */ 323 | u16 key_len; 324 | u8 key[32]; 325 | }; 326 | 327 | struct wpa_driver_rx_filter_params { 328 | struct wpa_driver_test_mode_info hdr; 329 | u32 Ipv4FilterHigh; 330 | u32 Ipv4FilterLow; 331 | u32 Ipv6FilterHigh; 332 | u32 Ipv6FilterLow; 333 | u32 SnapFilterHigh; 334 | u32 SnapFilterLow; 335 | }; 336 | 337 | struct wpa_driver_wapi_key_params { 338 | struct wpa_driver_test_mode_info hdr; 339 | u8 key_index; 340 | u8 key_len; 341 | struct iw_encode_exts extparams; 342 | }; 343 | 344 | /* CONFIG_MTK_P2P */ 345 | struct wpa_driver_wfd_data_s { 346 | struct wpa_driver_test_mode_info hdr; 347 | u32 WfdCmdType; 348 | u8 WfdEnable; 349 | u8 WfdCoupleSinkStatus; 350 | u8 WfdSessionAvailable; 351 | u8 WfdSigmaMode; 352 | u16 WfdDevInfo; 353 | u16 WfdControlPort; 354 | u16 WfdMaximumTp; 355 | u16 WfdExtendCap; 356 | u8 WfdCoupleSinkAddress[ETH_ALEN]; 357 | u8 WfdAssociatedBssid[ETH_ALEN]; 358 | u8 WfdVideoIp[4]; 359 | u8 WfdAudioIp[4]; 360 | u16 WfdVideoPort; 361 | u16 WfdAudioPort; 362 | u32 WfdFlag; 363 | u32 WfdPolicy; 364 | u32 WfdState; 365 | u8 WfdSessionInformationIE[24*8]; /* Include Subelement ID, length */ 366 | u16 WfdSessionInformationIELen; 367 | u8 Reverved1[2]; 368 | u8 WfdPrimarySinkMac[ETH_ALEN]; 369 | u8 WfdSecondarySinkMac[ETH_ALEN]; 370 | u32 WfdAdvancedFlag; 371 | /* Group 1 64 bytes */ 372 | u8 WfdLocalIp[4]; 373 | u16 WfdLifetimeAc2; /* Unit is 2 TU */ 374 | u16 WfdLifetimeAc3; /* Unit is 2 TU */ 375 | u16 WfdCounterThreshold; /* Unit is ms */ 376 | u8 Reverved2[54]; 377 | /* Group 2 64 bytes */ 378 | u8 Reverved3[64]; 379 | /* Group 3 64 bytes */ 380 | u8 Reverved4[64]; 381 | } wfd_data; 382 | 383 | struct wpa_driver_set_beamplus_params { 384 | struct wpa_driver_test_mode_info hdr; 385 | u32 value; 386 | }; 387 | 388 | enum nl80211_testmode_params { 389 | /* Old test mode command id, compatible with exist testmode command */ 390 | NL80211_TESTMODE_SW_CMD = 1, 391 | NL80211_TESTMODE_WAPI = 2, 392 | NL80211_TESTMODE_HS20 = 3, 393 | NL80211_TESTMODE_POORLINK = 4, 394 | NL80211_TESTMODE_STATISTICS = 0x10, 395 | NL80211_TESTMODE_LINK_DETECT = 0x20, 396 | 397 | // Hotspot manager testmode command 398 | NL80211_TESTMODE_HS_SET_CONFIG = 51, 399 | 400 | /* New test mode command id, should greater than TESTMODE_CMD_ID_NEW_BEGIN */ 401 | NL80211_TESTMODE_NEW_BEGIN = 100, 402 | NL80211_TESTMODE_SUSPEND = 101, 403 | NL80211_TESTMODE_STR_CMD = 102, 404 | NL80211_TESTMODE_RXFILTER = 103 405 | }; 406 | 407 | #endif 408 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | LOCAL_PATH := $(call my-dir) 16 | 17 | # Make the HAL library 18 | # ============================================================ 19 | include $(CLEAR_VARS) 20 | 21 | LOCAL_REQUIRED_MODULES := 22 | 23 | LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast 24 | LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses 25 | LOCAL_CPPFLAGS += -Wno-conversion-null 26 | 27 | ifeq ($(MTK_TC7_FEATURE), yes) 28 | LOCAL_CFLAGS += -DCONFIG_PNO_SUPPORT 29 | endif 30 | 31 | LOCAL_C_INCLUDES += \ 32 | external/libnl/include \ 33 | $(call include-path-for, libhardware_legacy)/hardware_legacy \ 34 | external/wpa_supplicant_8/src/drivers 35 | 36 | LOCAL_SRC_FILES := \ 37 | wifi_hal.cpp \ 38 | rtt.cpp \ 39 | common.cpp \ 40 | cpp_bindings.cpp \ 41 | gscan.cpp \ 42 | link_layer_stats.cpp \ 43 | wifi_offload.cpp 44 | 45 | LOCAL_MODULE := libwifi-hal-mt66xx 46 | LOCAL_PROPRIETARY_MODULE := true 47 | LOCAL_MODULE_OWNER := mtk 48 | 49 | include $(BUILD_STATIC_LIBRARY) 50 | 51 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (c) , 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following 8 | disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 10 | following disclaimer in the documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the names of its contributors may be used to endorse or promote 12 | products derived from this software without specific prior written permission. 13 | 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 16 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 20 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 21 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/README: -------------------------------------------------------------------------------- 1 | This directory contains WIFI_HAL interface and function 2 | 3 | 4 | WHAT IT DOES? 5 | ============= 6 | It provide another method for WIFI HAL to access WIFI driver which is different from wpa_supplicant. 7 | 8 | 9 | HOW IT WAS BUILT? 10 | ================== 11 | It needs the following libs from AOSP: 12 | 13 | 14 | and the following libs from MediaTek: 15 | 16 | 17 | All source/dependency modules of this module are already put in 18 | 'hardware/mediatek/wlan/wifi_hal' folder. 19 | 20 | 21 | HOW TO USE IT? 22 | ============== 23 | Files in this directory is used for WIFI HAL interface and function 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/common.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "wifi_hal.h" 20 | #include "common.h" 21 | #include "cpp_bindings.h" 22 | 23 | interface_info *getIfaceInfo(wifi_interface_handle handle) 24 | { 25 | return (interface_info *)handle; 26 | } 27 | 28 | wifi_handle getWifiHandle(wifi_interface_handle handle) 29 | { 30 | return getIfaceInfo(handle)->handle; 31 | } 32 | 33 | hal_info *getHalInfo(wifi_handle handle) 34 | { 35 | return (hal_info *)handle; 36 | } 37 | 38 | hal_info *getHalInfo(wifi_interface_handle handle) 39 | { 40 | return getHalInfo(getWifiHandle(handle)); 41 | } 42 | 43 | wifi_handle getWifiHandle(hal_info *info) 44 | { 45 | return (wifi_handle)info; 46 | } 47 | 48 | wifi_interface_handle getIfaceHandle(interface_info *info) 49 | { 50 | return (wifi_interface_handle)info; 51 | } 52 | 53 | wifi_error wifi_register_handler(wifi_handle handle, int cmd, nl_recvmsg_msg_cb_t func, void *arg) 54 | { 55 | hal_info *info = (hal_info *)handle; 56 | 57 | /* TODO: check for multiple handlers? */ 58 | pthread_mutex_lock(&info->cb_lock); 59 | 60 | wifi_error result = WIFI_ERROR_OUT_OF_MEMORY; 61 | 62 | if (info->num_event_cb < info->alloc_event_cb) { 63 | info->event_cb[info->num_event_cb].nl_cmd = cmd; 64 | info->event_cb[info->num_event_cb].vendor_id = 0; 65 | info->event_cb[info->num_event_cb].vendor_subcmd = 0; 66 | info->event_cb[info->num_event_cb].cb_func = func; 67 | info->event_cb[info->num_event_cb].cb_arg = arg; 68 | ALOGV("Successfully added event handler %p:%p for command %d at %d", 69 | arg, func, cmd, info->num_event_cb); 70 | info->num_event_cb++; 71 | result = WIFI_SUCCESS; 72 | } 73 | 74 | pthread_mutex_unlock(&info->cb_lock); 75 | return result; 76 | } 77 | 78 | wifi_error wifi_register_vendor_handler(wifi_handle handle, 79 | uint32_t id, int subcmd, nl_recvmsg_msg_cb_t func, void *arg) 80 | { 81 | hal_info *info = (hal_info *)handle; 82 | 83 | /* TODO: check for multiple handlers? */ 84 | pthread_mutex_lock(&info->cb_lock); 85 | 86 | wifi_error result = WIFI_ERROR_OUT_OF_MEMORY; 87 | 88 | if (info->num_event_cb < info->alloc_event_cb) { 89 | info->event_cb[info->num_event_cb].nl_cmd = NL80211_CMD_VENDOR; 90 | info->event_cb[info->num_event_cb].vendor_id = id; 91 | info->event_cb[info->num_event_cb].vendor_subcmd = subcmd; 92 | info->event_cb[info->num_event_cb].cb_func = func; 93 | info->event_cb[info->num_event_cb].cb_arg = arg; 94 | ALOGV("Added event handler %p:%p for vendor 0x%0x and subcmd 0x%0x at %d", 95 | arg, func, id, subcmd, info->num_event_cb); 96 | info->num_event_cb++; 97 | result = WIFI_SUCCESS; 98 | } 99 | 100 | pthread_mutex_unlock(&info->cb_lock); 101 | return result; 102 | } 103 | 104 | void wifi_unregister_handler(wifi_handle handle, int cmd) 105 | { 106 | hal_info *info = (hal_info *)handle; 107 | 108 | if (cmd == NL80211_CMD_VENDOR) { 109 | ALOGE("Must use wifi_unregister_vendor_handler to remove vendor handlers"); 110 | return; 111 | } 112 | 113 | pthread_mutex_lock(&info->cb_lock); 114 | 115 | for (int i = 0; i < info->num_event_cb; i++) { 116 | if (info->event_cb[i].nl_cmd == cmd) { 117 | ALOGV("Successfully removed event handler %p:%p for cmd = 0x%0x from %d", 118 | info->event_cb[i].cb_arg, info->event_cb[i].cb_func, cmd, i); 119 | 120 | memmove(&info->event_cb[i], &info->event_cb[i+1], 121 | (info->num_event_cb - i - 1) * sizeof(cb_info)); 122 | info->num_event_cb--; 123 | break; 124 | } 125 | } 126 | 127 | pthread_mutex_unlock(&info->cb_lock); 128 | } 129 | 130 | void wifi_unregister_vendor_handler(wifi_handle handle, uint32_t id, int subcmd) 131 | { 132 | hal_info *info = (hal_info *)handle; 133 | 134 | pthread_mutex_lock(&info->cb_lock); 135 | 136 | for (int i = 0; i < info->num_event_cb; i++) { 137 | 138 | if (info->event_cb[i].nl_cmd == NL80211_CMD_VENDOR 139 | && info->event_cb[i].vendor_id == id 140 | && info->event_cb[i].vendor_subcmd == subcmd) { 141 | ALOGV("Successfully removed event handler %p:%p for vendor 0x%0x, subcmd 0x%0x from %d", 142 | info->event_cb[i].cb_arg, info->event_cb[i].cb_func, id, subcmd, i); 143 | memmove(&info->event_cb[i], &info->event_cb[i+1], 144 | (info->num_event_cb - i - 1) * sizeof(cb_info)); 145 | info->num_event_cb--; 146 | break; 147 | } 148 | } 149 | 150 | pthread_mutex_unlock(&info->cb_lock); 151 | } 152 | 153 | 154 | wifi_error wifi_register_cmd(wifi_handle handle, int id, WifiCommand *cmd) 155 | { 156 | hal_info *info = (hal_info *)handle; 157 | 158 | ALOGV("registering command %d", id); 159 | 160 | wifi_error result = WIFI_ERROR_OUT_OF_MEMORY; 161 | 162 | if (info->num_cmd < info->alloc_cmd) { 163 | info->cmd[info->num_cmd].id = id; 164 | info->cmd[info->num_cmd].cmd = cmd; 165 | ALOGV("Successfully added command %d: %p at %d", id, cmd, info->num_cmd); 166 | info->num_cmd++; 167 | result = WIFI_SUCCESS; 168 | } else { 169 | ALOGE("Failed to add command %d: %p at %d, reached max limit %d", 170 | id, cmd, info->num_cmd, info->alloc_cmd); 171 | } 172 | 173 | return result; 174 | } 175 | 176 | WifiCommand *wifi_unregister_cmd(wifi_handle handle, int id) 177 | { 178 | hal_info *info = (hal_info *)handle; 179 | 180 | ALOGV("un-registering command %d", id); 181 | 182 | WifiCommand *cmd = NULL; 183 | 184 | for (int i = 0; i < info->num_cmd; i++) { 185 | if (info->cmd[i].id == id) { 186 | cmd = info->cmd[i].cmd; 187 | memmove(&info->cmd[i], &info->cmd[i+1], (info->num_cmd - i) * sizeof(cmd_info)); 188 | info->num_cmd--; 189 | ALOGV("Successfully removed command %d: %p from %d", id, cmd, i); 190 | break; 191 | } 192 | } 193 | 194 | if (!cmd) { 195 | ALOGE("Failed to remove command %d: %p", id, cmd); 196 | } 197 | 198 | return cmd; 199 | } 200 | 201 | WifiCommand *wifi_get_cmd(wifi_handle handle, int id) 202 | { 203 | hal_info *info = (hal_info *)handle; 204 | 205 | WifiCommand *cmd = NULL; 206 | 207 | for (int i = 0; i < info->num_cmd; i++) { 208 | if (info->cmd[i].id == id) { 209 | cmd = info->cmd[i].cmd; 210 | break; 211 | } 212 | } 213 | 214 | return cmd; 215 | } 216 | 217 | void wifi_unregister_cmd(wifi_handle handle, WifiCommand *cmd) 218 | { 219 | hal_info *info = (hal_info *)handle; 220 | 221 | for (int i = 0; i < info->num_cmd; i++) { 222 | if (info->cmd[i].cmd == cmd) { 223 | int id = info->cmd[i].id; 224 | memmove(&info->cmd[i], &info->cmd[i+1], (info->num_cmd - i) * sizeof(cmd_info)); 225 | info->num_cmd--; 226 | ALOGV("Successfully removed command %d: %p from %d", id, cmd, i); 227 | break; 228 | } 229 | } 230 | } 231 | 232 | wifi_error wifi_cancel_cmd(wifi_request_id id, wifi_interface_handle iface) 233 | { 234 | wifi_handle handle = getWifiHandle(iface); 235 | 236 | WifiCommand *cmd = wifi_unregister_cmd(handle, id); 237 | ALOGV("Cancel WifiCommand = %p", cmd); 238 | if (cmd) { 239 | cmd->cancel(); 240 | cmd->releaseRef(); 241 | return WIFI_SUCCESS; 242 | } 243 | 244 | return WIFI_ERROR_INVALID_ARGS; 245 | } 246 | 247 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/common.h: -------------------------------------------------------------------------------- 1 | 2 | #include "wifi_hal.h" 3 | 4 | #ifndef __WIFI_HAL_COMMON_H__ 5 | #define __WIFI_HAL_COMMON_H__ 6 | 7 | #define LOG_TAG "WifiHAL" 8 | 9 | #include 10 | #include "nl80211_copy.h" 11 | #include "sync.h" 12 | 13 | #define SOCKET_BUFFER_SIZE (32768U) 14 | #define RECV_BUF_SIZE (4096) 15 | #define DEFAULT_EVENT_CB_SIZE (64) 16 | #define DEFAULT_CMD_SIZE (64) 17 | #define DOT11_OUI_LEN 3 18 | #define DOT11_MAX_SSID_LEN 32 19 | 20 | #define MAX_PROBE_RESP_IE_LEN 2048 21 | /* 22 | Vendor OUI - This is a unique identifier that identifies organization. Lets 23 | code Android specific functions with Google OUI; although vendors can do more 24 | with their own OUI's as well. 25 | */ 26 | 27 | const uint32_t GOOGLE_OUI = 0x001A11; 28 | /* TODO: define vendor OUI here */ 29 | 30 | #ifndef MAC2STR 31 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] 32 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" 33 | #endif 34 | 35 | /* 36 | This enum defines ranges for various commands; commands themselves 37 | can be defined in respective feature headers; i.e. find gscan command 38 | definitions in gscan.cpp 39 | */ 40 | 41 | typedef enum { 42 | /* Don't use 0 as a valid subcommand */ 43 | ANDROID_NL80211_SUBCMD_UNSPECIFIED, 44 | 45 | /* Define all vendor startup commands between 0x0 and 0x0FFF */ 46 | ANDROID_NL80211_SUBCMD_WIFI_RANGE_START = 0x0001, 47 | ANDROID_NL80211_SUBCMD_WIFI_RANGE_END = 0x0FFF, 48 | 49 | /* Define all GScan related commands between 0x1000 and 0x10FF */ 50 | ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START = 0x1000, 51 | ANDROID_NL80211_SUBCMD_GSCAN_RANGE_END = 0x10FF, 52 | 53 | /* Define all RTT related commands between 0x1100 and 0x11FF */ 54 | ANDROID_NL80211_SUBCMD_RTT_RANGE_START = 0x1100, 55 | ANDROID_NL80211_SUBCMD_RTT_RANGE_END = 0x11FF, 56 | 57 | ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START = 0x1200, 58 | ANDROID_NL80211_SUBCMD_LSTATS_RANGE_END = 0x12FF, 59 | 60 | /* Define all Logger related commands between 0x1400 and 0x14FF */ 61 | ANDROID_NL80211_SUBCMD_DEBUG_RANGE_START = 0x1400, 62 | ANDROID_NL80211_SUBCMD_DEBUG_RANGE_END = 0x14FF, 63 | 64 | /* Define all wifi offload related commands between 0x1600 and 0x16FF */ 65 | ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_START = 0x1600, 66 | ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_END = 0x16FF, 67 | 68 | /* This is reserved for future usage */ 69 | 70 | } ANDROID_VENDOR_SUB_COMMAND; 71 | 72 | typedef enum { 73 | GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS, 74 | GSCAN_EVENT_HOTLIST_RESULTS_FOUND, 75 | GSCAN_EVENT_SCAN_RESULTS_AVAILABLE, 76 | GSCAN_EVENT_FULL_SCAN_RESULTS, 77 | RTT_EVENT_COMPLETE, 78 | GSCAN_EVENT_COMPLETE_SCAN, 79 | GSCAN_EVENT_HOTLIST_RESULTS_LOST, 80 | WIFI_EVENT_RSSI_MONITOR, 81 | GSCAN_EVENT_EPNO_EVENT, 82 | GSCAN_EVENT_ANQPO_HOTSPOT_MATCH, 83 | } WIFI_VENDOR_EVENT; 84 | 85 | typedef void (*wifi_internal_event_handler) (wifi_handle handle, int events); 86 | 87 | class WifiCommand; 88 | 89 | typedef struct { 90 | int nl_cmd; 91 | uint32_t vendor_id; 92 | int vendor_subcmd; 93 | nl_recvmsg_msg_cb_t cb_func; 94 | void *cb_arg; 95 | } cb_info; 96 | 97 | typedef struct { 98 | wifi_request_id id; 99 | WifiCommand *cmd; 100 | } cmd_info; 101 | 102 | typedef struct { 103 | wifi_handle handle; // handle to wifi data 104 | char name[8+1]; // interface name + trailing null 105 | int id; // id to use when talking to driver 106 | } interface_info; 107 | 108 | typedef struct { 109 | 110 | struct nl_sock *cmd_sock; // command socket object 111 | struct nl_sock *event_sock; // event socket object 112 | int nl80211_family_id; // family id for 80211 driver 113 | int cleanup_socks[2]; // sockets used to implement wifi_cleanup 114 | 115 | bool in_event_loop; // Indicates that event loop is active 116 | bool clean_up; // Indication to clean up the socket 117 | 118 | wifi_internal_event_handler event_handler; // default event handler 119 | wifi_cleaned_up_handler cleaned_up_handler; // socket cleaned up handler 120 | 121 | cb_info *event_cb; // event callbacks 122 | int num_event_cb; // number of event callbacks 123 | int alloc_event_cb; // number of allocated callback objects 124 | pthread_mutex_t cb_lock; // mutex for the event_cb access 125 | 126 | cmd_info *cmd; // Outstanding commands 127 | int num_cmd; // number of commands 128 | int alloc_cmd; // number of commands allocated 129 | 130 | interface_info **interfaces; // array of interfaces 131 | int num_interfaces; // number of interfaces 132 | 133 | 134 | // add other details 135 | } hal_info; 136 | 137 | #define PNO_SSID_FOUND 0x1 138 | #define PNO_SSID_LOST 0x2 139 | 140 | typedef struct wifi_pno_result { 141 | unsigned char ssid[32]; 142 | unsigned char ssid_len; 143 | signed char rssi; 144 | u16 channel; 145 | u16 flags; 146 | mac_addr bssid; 147 | } wifi_pno_result_t; 148 | 149 | typedef struct wifi_gscan_result { 150 | u64 ts; // Time of discovery 151 | u8 ssid[DOT11_MAX_SSID_LEN+1]; // null terminated 152 | mac_addr bssid; // BSSID 153 | u32 channel; // channel frequency in MHz 154 | s32 rssi; // in db 155 | u64 rtt; // in nanoseconds 156 | u64 rtt_sd; // standard deviation in rtt 157 | u16 beacon_period; // units are Kusec 158 | u16 capability; // Capability information 159 | u32 ie_length; 160 | char ie_data[1]; 161 | } wifi_gscan_result_t; 162 | 163 | typedef struct wifi_gscan_full_result { 164 | wifi_gscan_result_t fixed; 165 | u32 scan_ch_bucket; // scan chbucket bitmask 166 | u32 ie_length; // byte length of Information Elements 167 | u8 ie_data[1]; // IE data to follow 168 | } wifi_gscan_full_result_t; 169 | 170 | wifi_error wifi_register_handler(wifi_handle handle, int cmd, nl_recvmsg_msg_cb_t func, void *arg); 171 | wifi_error wifi_register_vendor_handler(wifi_handle handle, 172 | uint32_t id, int subcmd, nl_recvmsg_msg_cb_t func, void *arg); 173 | 174 | void wifi_unregister_handler(wifi_handle handle, int cmd); 175 | void wifi_unregister_vendor_handler(wifi_handle handle, uint32_t id, int subcmd); 176 | 177 | wifi_error wifi_register_cmd(wifi_handle handle, int id, WifiCommand *cmd); 178 | WifiCommand *wifi_unregister_cmd(wifi_handle handle, int id); 179 | WifiCommand *wifi_get_cmd(wifi_handle handle, int id); 180 | void wifi_unregister_cmd(wifi_handle handle, WifiCommand *cmd); 181 | 182 | interface_info *getIfaceInfo(wifi_interface_handle); 183 | wifi_handle getWifiHandle(wifi_interface_handle handle); 184 | hal_info *getHalInfo(wifi_handle handle); 185 | hal_info *getHalInfo(wifi_interface_handle handle); 186 | wifi_handle getWifiHandle(hal_info *info); 187 | wifi_interface_handle getIfaceHandle(interface_info *info); 188 | wifi_error wifi_cancel_cmd(wifi_request_id id, wifi_interface_handle iface); 189 | 190 | // some common macros 191 | 192 | #define min(x, y) ((x) < (y) ? (x) : (y)) 193 | #define max(x, y) ((x) > (y) ? (x) : (y)) 194 | 195 | #endif 196 | 197 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/cpp_bindings.h: -------------------------------------------------------------------------------- 1 | 2 | #include "wifi_hal.h" 3 | #include "common.h" 4 | #include "sync.h" 5 | 6 | class WifiEvent 7 | { 8 | /* TODO: remove this when nl headers are updated */ 9 | static const unsigned NL80211_ATTR_MAX_INTERNAL = 256; 10 | private: 11 | struct nl_msg *mMsg; 12 | struct genlmsghdr *mHeader; 13 | struct nlattr *mAttributes[NL80211_ATTR_MAX_INTERNAL + 1]; 14 | 15 | public: 16 | WifiEvent(nl_msg *msg) { 17 | mMsg = msg; 18 | mHeader = NULL; 19 | memset(mAttributes, 0, sizeof(mAttributes)); 20 | } 21 | ~WifiEvent() { 22 | /* don't destroy mMsg; it doesn't belong to us */ 23 | } 24 | 25 | void log(); 26 | 27 | int parse(); 28 | 29 | genlmsghdr *header() { 30 | return mHeader; 31 | } 32 | 33 | int get_cmd() { 34 | return mHeader->cmd; 35 | } 36 | 37 | int get_vendor_id() { 38 | return get_u32(NL80211_ATTR_VENDOR_ID); 39 | } 40 | 41 | int get_vendor_subcmd() { 42 | return get_u32(NL80211_ATTR_VENDOR_SUBCMD); 43 | } 44 | 45 | void *get_vendor_data() { 46 | return get_data(NL80211_ATTR_VENDOR_DATA); 47 | } 48 | 49 | int get_vendor_data_len() { 50 | return get_len(NL80211_ATTR_VENDOR_DATA); 51 | } 52 | 53 | const char *get_cmdString(); 54 | 55 | nlattr ** attributes() { 56 | return mAttributes; 57 | } 58 | 59 | nlattr *get_attribute(int attribute) { 60 | return mAttributes[attribute]; 61 | } 62 | 63 | uint8_t get_u8(int attribute) { 64 | return mAttributes[attribute] ? nla_get_u8(mAttributes[attribute]) : 0; 65 | } 66 | 67 | uint16_t get_u16(int attribute) { 68 | return mAttributes[attribute] ? nla_get_u16(mAttributes[attribute]) : 0; 69 | } 70 | 71 | uint32_t get_u32(int attribute) { 72 | return mAttributes[attribute] ? nla_get_u32(mAttributes[attribute]) : 0; 73 | } 74 | 75 | uint64_t get_u64(int attribute) { 76 | return mAttributes[attribute] ? nla_get_u64(mAttributes[attribute]) : 0; 77 | } 78 | 79 | int get_len(int attribute) { 80 | return mAttributes[attribute] ? nla_len(mAttributes[attribute]) : 0; 81 | } 82 | 83 | void *get_data(int attribute) { 84 | return mAttributes[attribute] ? nla_data(mAttributes[attribute]) : NULL; 85 | } 86 | 87 | private: 88 | WifiEvent(const WifiEvent&); // hide copy constructor to prevent copies 89 | }; 90 | 91 | class nl_iterator { 92 | struct nlattr *pos; 93 | int rem; 94 | public: 95 | nl_iterator(struct nlattr *attr) { 96 | pos = (struct nlattr *)nla_data(attr); 97 | rem = nla_len(attr); 98 | } 99 | bool has_next() { 100 | return nla_ok(pos, rem); 101 | } 102 | void next() { 103 | pos = (struct nlattr *)nla_next(pos, &(rem)); 104 | } 105 | struct nlattr *get() { 106 | return pos; 107 | } 108 | uint16_t get_type() { 109 | return pos->nla_type; 110 | } 111 | uint8_t get_u8() { 112 | return nla_get_u8(pos); 113 | } 114 | uint16_t get_u16() { 115 | return nla_get_u16(pos); 116 | } 117 | uint32_t get_u32() { 118 | return nla_get_u32(pos); 119 | } 120 | uint64_t get_u64() { 121 | return nla_get_u64(pos); 122 | } 123 | void* get_data() { 124 | return nla_data(pos); 125 | } 126 | int get_len() { 127 | return nla_len(pos); 128 | } 129 | private: 130 | nl_iterator(const nl_iterator&); // hide copy constructor to prevent copies 131 | }; 132 | 133 | class WifiRequest 134 | { 135 | private: 136 | int mFamily; 137 | int mIface; 138 | struct nl_msg *mMsg; 139 | 140 | public: 141 | WifiRequest(int family) { 142 | mMsg = NULL; 143 | mFamily = family; 144 | mIface = -1; 145 | } 146 | 147 | WifiRequest(int family, int iface) { 148 | mMsg = NULL; 149 | mFamily = family; 150 | mIface = iface; 151 | } 152 | 153 | ~WifiRequest() { 154 | destroy(); 155 | } 156 | 157 | void destroy() { 158 | if (mMsg) { 159 | nlmsg_free(mMsg); 160 | mMsg = NULL; 161 | } 162 | } 163 | 164 | nl_msg *getMessage() { 165 | return mMsg; 166 | } 167 | 168 | /* Command assembly helpers */ 169 | int create(int family, uint8_t cmd, int flags, int hdrlen); 170 | int create(uint8_t cmd) { 171 | return create(mFamily, cmd, 0, 0); 172 | } 173 | 174 | int create(uint32_t id, int subcmd); 175 | 176 | int put(int attribute, void *ptr, unsigned len) { 177 | return nla_put(mMsg, attribute, len, ptr); 178 | } 179 | int put_u8(int attribute, uint8_t value) { 180 | return nla_put(mMsg, attribute, sizeof(value), &value); 181 | } 182 | int put_u16(int attribute, uint16_t value) { 183 | return nla_put(mMsg, attribute, sizeof(value), &value); 184 | } 185 | int put_u32(int attribute, uint32_t value) { 186 | return nla_put(mMsg, attribute, sizeof(value), &value); 187 | } 188 | int put_u64(int attribute, uint64_t value) { 189 | return nla_put(mMsg, attribute, sizeof(value), &value); 190 | } 191 | int put_string(int attribute, const char *value) { 192 | return nla_put(mMsg, attribute, strlen(value) + 1, value); 193 | } 194 | int put_addr(int attribute, mac_addr value) { 195 | return nla_put(mMsg, attribute, sizeof(mac_addr), value); 196 | } 197 | 198 | struct nlattr * attr_start(int attribute) { 199 | return nla_nest_start(mMsg, attribute); 200 | } 201 | void attr_end(struct nlattr *attr) { 202 | nla_nest_end(mMsg, attr); 203 | } 204 | 205 | int set_iface_id(int ifindex) { 206 | return put_u32(NL80211_ATTR_IFINDEX, ifindex); 207 | } 208 | private: 209 | WifiRequest(const WifiRequest&); // hide copy constructor to prevent copies 210 | 211 | }; 212 | 213 | class WifiCommand 214 | { 215 | protected: 216 | hal_info *mInfo; 217 | WifiRequest mMsg; 218 | Condition mCondition; 219 | wifi_request_id mId; 220 | interface_info *mIfaceInfo; 221 | int mRefs; 222 | public: 223 | WifiCommand(wifi_handle handle, wifi_request_id id) 224 | : mMsg(getHalInfo(handle)->nl80211_family_id), mId(id), mRefs(1) 225 | { 226 | mIfaceInfo = NULL; 227 | mInfo = getHalInfo(handle); 228 | // ALOGD("WifiCommand %p created, mInfo = %p, mIfaceInfo = %p", this, mInfo, mIfaceInfo); 229 | } 230 | 231 | WifiCommand(wifi_interface_handle iface, wifi_request_id id) 232 | : mMsg(getHalInfo(iface)->nl80211_family_id, getIfaceInfo(iface)->id), mId(id), mRefs(1) 233 | { 234 | mIfaceInfo = getIfaceInfo(iface); 235 | mInfo = getHalInfo(iface); 236 | // ALOGD("WifiCommand2 %p created, mInfo=%p, mIfaceInfo=%p, id=%d", this, mInfo, mIfaceInfo, mIfaceInfo->id); 237 | } 238 | 239 | virtual ~WifiCommand() { 240 | // ALOGD("WifiCommand %p destroyed", this); 241 | } 242 | 243 | wifi_request_id id() { 244 | return mId; 245 | } 246 | 247 | virtual void addRef() { 248 | int refs = __sync_add_and_fetch(&mRefs, 1); 249 | // ALOGD("addRef: WifiCommand %p has %d references", this, refs); 250 | } 251 | 252 | virtual void releaseRef() { 253 | int refs = __sync_sub_and_fetch(&mRefs, 1); 254 | if (refs == 0) { 255 | delete this; 256 | } else { 257 | // ALOGD("releaseRef: WifiCommand %p has %d references", this, refs); 258 | } 259 | } 260 | 261 | virtual int create() { 262 | /* by default there is no way to cancel */ 263 | ALOGD("WifiCommand %p can't be created", this); 264 | return WIFI_ERROR_NOT_SUPPORTED; 265 | } 266 | 267 | virtual int cancel() { 268 | /* by default there is no way to cancel */ 269 | return WIFI_ERROR_NOT_SUPPORTED; 270 | } 271 | 272 | int requestResponse(); 273 | int requestEvent(int cmd); 274 | int requestVendorEvent(uint32_t id, int subcmd); 275 | int requestResponse(WifiRequest& request); 276 | 277 | protected: 278 | wifi_handle wifiHandle() { 279 | return getWifiHandle(mInfo); 280 | } 281 | 282 | wifi_interface_handle ifaceHandle() { 283 | return getIfaceHandle(mIfaceInfo); 284 | } 285 | 286 | int familyId() { 287 | return mInfo->nl80211_family_id; 288 | } 289 | 290 | int ifaceId() { 291 | return mIfaceInfo->id; 292 | } 293 | 294 | /* Override this method to parse reply and dig out data; save it in the object */ 295 | virtual int handleResponse(WifiEvent& reply) { 296 | ALOGI("skipping a response"); 297 | return NL_SKIP; 298 | } 299 | 300 | /* Override this method to parse event and dig out data; save it in the object */ 301 | virtual int handleEvent(WifiEvent& event) { 302 | ALOGI("skipping an event"); 303 | return NL_SKIP; 304 | } 305 | 306 | int registerHandler(int cmd) { 307 | return wifi_register_handler(wifiHandle(), cmd, &event_handler, this); 308 | } 309 | 310 | void unregisterHandler(int cmd) { 311 | wifi_unregister_handler(wifiHandle(), cmd); 312 | } 313 | 314 | int registerVendorHandler(uint32_t id, int subcmd) { 315 | return wifi_register_vendor_handler(wifiHandle(), id, subcmd, &event_handler, this); 316 | } 317 | 318 | void unregisterVendorHandler(uint32_t id, int subcmd) { 319 | wifi_unregister_vendor_handler(wifiHandle(), id, subcmd); 320 | } 321 | 322 | private: 323 | WifiCommand(const WifiCommand& ); // hide copy constructor to prevent copies 324 | 325 | /* Event handling */ 326 | static int response_handler(struct nl_msg *msg, void *arg); 327 | 328 | static int event_handler(struct nl_msg *msg, void *arg); 329 | 330 | /* Other event handlers */ 331 | static int valid_handler(struct nl_msg *msg, void *arg); 332 | 333 | static int ack_handler(struct nl_msg *msg, void *arg); 334 | 335 | static int finish_handler(struct nl_msg *msg, void *arg); 336 | 337 | static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg); 338 | }; 339 | 340 | /* nl message processing macros (required to pass C++ type checks) */ 341 | 342 | #define for_each_attr(pos, nla, rem) \ 343 | for (pos = (nlattr *)nla_data(nla), rem = nla_len(nla); \ 344 | nla_ok(pos, rem); \ 345 | pos = (nlattr *)nla_next(pos, &(rem))) 346 | 347 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/link_layer_stats.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "sync.h" 20 | 21 | #define LOG_TAG "WifiHAL" 22 | 23 | #include 24 | 25 | #include "wifi_hal.h" 26 | #include "common.h" 27 | #include "cpp_bindings.h" 28 | 29 | 30 | typedef enum { 31 | LSTATS_SUBCMD_GET_INFO = ANDROID_NL80211_SUBCMD_LSTATS_RANGE_START, 32 | } LSTATS_SUB_COMMAND; 33 | 34 | typedef enum { 35 | LSTATS_ATTRIBUTE_STATS = 2, 36 | } LSTATS_ATTRIBUTE; 37 | 38 | /////////////////////////////////////////////////////////////////////////////////// 39 | class GetLinkStatsCommand : public WifiCommand 40 | { 41 | wifi_stats_result_handler mHandler; 42 | public: 43 | GetLinkStatsCommand(wifi_interface_handle iface, wifi_stats_result_handler handler) 44 | : WifiCommand(iface, 0), mHandler(handler) 45 | { } 46 | 47 | virtual int create() { 48 | ALOGD("[WIFI HAL]Creating message to get link statistics; iface = %d", mIfaceInfo->id); 49 | 50 | int ret = mMsg.create(GOOGLE_OUI, LSTATS_SUBCMD_GET_INFO); 51 | if (ret < 0) { 52 | ALOGE("Failed to create %x - %d", LSTATS_SUBCMD_GET_INFO, ret); 53 | return ret; 54 | } 55 | 56 | return ret; 57 | } 58 | 59 | protected: 60 | virtual int handleResponse(WifiEvent& reply) { 61 | ALOGD("[WIFI HAL]In GetLinkStatsCommand::handleResponse"); 62 | 63 | if (reply.get_cmd() != NL80211_CMD_VENDOR) { 64 | ALOGE("Ignoring reply with cmd = %d", reply.get_cmd()); 65 | return NL_SKIP; 66 | } 67 | 68 | int id = reply.get_vendor_id(); 69 | int subcmd = reply.get_vendor_subcmd(); 70 | 71 | // ALOGI("Id = %0x, subcmd = %d", id, subcmd); 72 | 73 | struct nlattr *vendor_data = (struct nlattr *)reply.get_vendor_data(); 74 | int len = reply.get_vendor_data_len(); 75 | wifi_radio_stat *data; 76 | 77 | if(vendor_data->nla_type == LSTATS_ATTRIBUTE_STATS) 78 | data = (wifi_radio_stat *)nla_data(vendor_data); 79 | else 80 | return NL_SKIP; 81 | int num_chan = data->num_channels; 82 | if (num_chan > 32) { 83 | ALOGE("Incorrect number of channels = %d", num_chan); 84 | return NL_SKIP; 85 | } 86 | 87 | /* 88 | (*mHandler.on_link_stats_results)(id, 89 | (wifi_iface_stat *)((char *)&(data)->channels 90 | + num_chan*sizeof(wifi_channel_stat)), 91 | 1, data); 92 | */ 93 | 94 | return NL_OK; 95 | } 96 | }; 97 | 98 | wifi_error wifi_get_link_stats(wifi_request_id id, 99 | wifi_interface_handle iface, wifi_stats_result_handler handler) 100 | { 101 | #if 0 102 | GetLinkStatsCommand command(iface, handler); 103 | return (wifi_error) command.requestResponse(); 104 | #else 105 | ALOGD("[WIFI HAL]don't support wifi_get_link_stats"); 106 | return WIFI_ERROR_NOT_SUPPORTED; 107 | #endif 108 | } 109 | 110 | -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/sync.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #ifndef __WIFI_HAL_SYNC_H__ 5 | #define __WIFI_HAL_SYNC_H__ 6 | 7 | class Mutex 8 | { 9 | private: 10 | pthread_mutex_t mMutex; 11 | public: 12 | Mutex() { 13 | pthread_mutex_init(&mMutex, NULL); 14 | } 15 | ~Mutex() { 16 | pthread_mutex_destroy(&mMutex); 17 | } 18 | int tryLock() { 19 | return pthread_mutex_trylock(&mMutex); 20 | } 21 | int lock() { 22 | return pthread_mutex_lock(&mMutex); 23 | } 24 | void unlock() { 25 | pthread_mutex_unlock(&mMutex); 26 | } 27 | }; 28 | 29 | class Condition 30 | { 31 | private: 32 | pthread_cond_t mCondition; 33 | pthread_mutex_t mMutex; 34 | 35 | public: 36 | Condition() { 37 | pthread_mutex_init(&mMutex, NULL); 38 | pthread_cond_init(&mCondition, NULL); 39 | } 40 | ~Condition() { 41 | pthread_cond_destroy(&mCondition); 42 | pthread_mutex_destroy(&mMutex); 43 | } 44 | 45 | int wait() { 46 | return pthread_cond_wait(&mCondition, &mMutex); 47 | } 48 | 49 | void signal() { 50 | pthread_cond_signal(&mCondition); 51 | } 52 | }; 53 | 54 | #endif -------------------------------------------------------------------------------- /mtk/libwifi-hal-mt66xx/wifi_offload.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "nl80211_copy.h" 19 | #include "sync.h" 20 | 21 | #define LOG_TAG "WifiHAL" 22 | 23 | #include 24 | 25 | #include "wifi_hal.h" 26 | #include "common.h" 27 | #include "cpp_bindings.h" 28 | 29 | using namespace android; 30 | 31 | typedef enum { 32 | WIFI_OFFLOAD_START_MKEEP_ALIVE = ANDROID_NL80211_SUBCMD_WIFI_OFFLOAD_RANGE_START, 33 | WIFI_OFFLOAD_STOP_MKEEP_ALIVE, 34 | } WIFI_OFFLOAD_SUB_COMMAND; 35 | 36 | typedef enum { 37 | MKEEP_ALIVE_ATTRIBUTE_ID = 1, 38 | MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN, 39 | MKEEP_ALIVE_ATTRIBUTE_IP_PKT, 40 | MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR, 41 | MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR, 42 | MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC 43 | } WIFI_MKEEP_ALIVE_ATTRIBUTE; 44 | 45 | typedef enum { 46 | START_MKEEP_ALIVE, 47 | STOP_MKEEP_ALIVE, 48 | } GetCmdType; 49 | 50 | /////////////////////////////////////////////////////////////////////////////// 51 | class MKeepAliveCommand : public WifiCommand 52 | { 53 | u8 mIndex; 54 | u8 *mIpPkt; 55 | u16 mIpPktLen; 56 | u8 *mSrcMacAddr; 57 | u8 *mDstMacAddr; 58 | u32 mPeriodMsec; 59 | GetCmdType mType; 60 | 61 | public: 62 | 63 | // constructor for start sending 64 | MKeepAliveCommand(wifi_interface_handle iface, u8 index, u8 *ip_packet, u16 ip_packet_len, 65 | u8 *src_mac_addr, u8 *dst_mac_addr, u32 period_msec, GetCmdType cmdType) 66 | : WifiCommand(iface, 0), mIndex(index), mIpPkt(ip_packet), mIpPktLen(ip_packet_len), 67 | mSrcMacAddr(src_mac_addr), mDstMacAddr(dst_mac_addr), mPeriodMsec(period_msec), 68 | mType(cmdType) 69 | { } 70 | 71 | // constructor for stop sending 72 | MKeepAliveCommand(wifi_interface_handle iface, u8 index, GetCmdType cmdType) 73 | : WifiCommand(iface, 0), mIndex(index), mType(cmdType) 74 | { } 75 | 76 | int createRequest(WifiRequest &request) { 77 | int result; 78 | 79 | switch (mType) { 80 | case START_MKEEP_ALIVE: 81 | { 82 | result = request.create(GOOGLE_OUI, WIFI_OFFLOAD_START_MKEEP_ALIVE); 83 | if (result != WIFI_SUCCESS) { 84 | ALOGE("Failed to create start keep alive request; result = %d", result); 85 | return result; 86 | } 87 | 88 | nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA); 89 | 90 | result = request.put_u8(MKEEP_ALIVE_ATTRIBUTE_ID, mIndex); 91 | if (result < 0) { 92 | ALOGE("Failed to put id request; result = %d", result); 93 | return result; 94 | } 95 | 96 | result = request.put_u16(MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN, mIpPktLen); 97 | if (result < 0) { 98 | ALOGE("Failed to put ip pkt len request; result = %d", result); 99 | return result; 100 | } 101 | 102 | result = request.put(MKEEP_ALIVE_ATTRIBUTE_IP_PKT, (u8*)mIpPkt, mIpPktLen); 103 | if (result < 0) { 104 | ALOGE("Failed to put ip pkt request; result = %d", result); 105 | return result; 106 | } 107 | 108 | result = request.put_addr(MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR, mSrcMacAddr); 109 | if (result < 0) { 110 | ALOGE("Failed to put src mac address request; result = %d", result); 111 | return result; 112 | } 113 | 114 | result = request.put_addr(MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR, mDstMacAddr); 115 | if (result < 0) { 116 | ALOGE("Failed to put dst mac address request; result = %d", result); 117 | return result; 118 | } 119 | 120 | result = request.put_u32(MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC, mPeriodMsec); 121 | if (result < 0) { 122 | ALOGE("Failed to put period request; result = %d", result); 123 | return result; 124 | } 125 | 126 | request.attr_end(data); 127 | break; 128 | } 129 | 130 | case STOP_MKEEP_ALIVE: 131 | { 132 | result = request.create(GOOGLE_OUI, WIFI_OFFLOAD_STOP_MKEEP_ALIVE); 133 | if (result != WIFI_SUCCESS) { 134 | ALOGE("Failed to create stop keep alive request; result = %d", result); 135 | return result; 136 | } 137 | 138 | nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA); 139 | 140 | result = request.put_u8(MKEEP_ALIVE_ATTRIBUTE_ID, mIndex); 141 | if (result < 0) { 142 | ALOGE("Failed to put id request; result = %d", result); 143 | return result; 144 | } 145 | 146 | request.attr_end(data); 147 | break; 148 | } 149 | 150 | default: 151 | ALOGE("Unknown wifi keep alive command"); 152 | result = WIFI_ERROR_UNKNOWN; 153 | } 154 | return result; 155 | } 156 | 157 | int start() { 158 | ALOGD("Start mkeep_alive command"); 159 | WifiRequest request(familyId(), ifaceId()); 160 | int result = createRequest(request); 161 | if (result != WIFI_SUCCESS) { 162 | ALOGE("Failed to create keep alive request; result = %d", result); 163 | return result; 164 | } 165 | 166 | result = requestResponse(request); 167 | if (result != WIFI_SUCCESS) { 168 | ALOGE("Failed to register keep alive response; result = %d", result); 169 | } 170 | return result; 171 | } 172 | 173 | virtual int handleResponse(WifiEvent& reply) { 174 | ALOGD("In MKeepAliveCommand::handleResponse"); 175 | 176 | if (reply.get_cmd() != NL80211_CMD_VENDOR) { 177 | ALOGD("Ignoring reply with cmd = %d", reply.get_cmd()); 178 | return NL_SKIP; 179 | } 180 | 181 | switch (mType) { 182 | case START_MKEEP_ALIVE: 183 | case STOP_MKEEP_ALIVE: 184 | break; 185 | 186 | default: 187 | ALOGW("Unknown mkeep_alive command"); 188 | } 189 | return NL_OK; 190 | } 191 | 192 | virtual int handleEvent(WifiEvent& event) { 193 | /* NO events! */ 194 | return NL_SKIP; 195 | } 196 | }; 197 | 198 | 199 | /* API to send specified mkeep_alive packet periodically. */ 200 | wifi_error wifi_start_sending_offloaded_packet(wifi_request_id index, wifi_interface_handle iface, 201 | u8 *ip_packet, u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr, u32 period_msec) 202 | { 203 | if ((index > 0 && index <= N_AVAIL_ID) && (ip_packet != NULL) && (src_mac_addr != NULL) 204 | && (dst_mac_addr != NULL) && (period_msec > 0) 205 | && (ip_packet_len <= MKEEP_ALIVE_IP_PKT_MAX)) { 206 | MKeepAliveCommand *cmd = new MKeepAliveCommand(iface, index, ip_packet, ip_packet_len, 207 | src_mac_addr, dst_mac_addr, period_msec, START_MKEEP_ALIVE); 208 | wifi_error err = (wifi_error) cmd->start(); 209 | delete cmd; 210 | return err; 211 | } else { 212 | ALOGE("Invalid mkeep_alive parameters"); 213 | return WIFI_ERROR_INVALID_ARGS; 214 | } 215 | } 216 | 217 | /* API to stop sending mkeep_alive packet. */ 218 | wifi_error wifi_stop_sending_offloaded_packet(wifi_request_id index, wifi_interface_handle iface) 219 | { 220 | if (index > 0 && index <= N_AVAIL_ID) { 221 | MKeepAliveCommand *cmd = new MKeepAliveCommand(iface, index, STOP_MKEEP_ALIVE); 222 | wifi_error err = (wifi_error) cmd->start(); 223 | delete cmd; 224 | return err; 225 | } else { 226 | ALOGE("Invalid mkeep_alive parameters"); 227 | return WIFI_ERROR_INVALID_ARGS; 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /overlay/aosp/frameworks/base/core/res/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | 7 | 8 | wifi,1,1,2,-1,true 9 | bluetooth,7,7,0,-1,true 10 | ethernet,9,9,0,-1,true 11 | 12 | 13 | 14 | 15 | 16 | 1,1 17 | 7,1 18 | 9,1 19 | 20 | 21 | 22 | 23 | 128 24 | 256 25 | 384 26 | 512 27 | 640 28 | 768 29 | 896 30 | 1024 31 | 2048 32 | 4096 33 | 6144 34 | 8192 35 | 10240 36 | 12288 37 | 14336 38 | 16384 39 | 18432 40 | 41 | 42 | 43 | 8 44 | 64 45 | 98 46 | 104 47 | 110 48 | 116 49 | 122 50 | 128 51 | 134 52 | 182 53 | 255 54 | 255 55 | 255 56 | 255 57 | 255 58 | 255 59 | 255 60 | 255 61 | 62 | 63 | 65 | true 66 | false 67 | 68 | 75 | false 76 | 77 | 79 | false 80 | 81 | 82 | true 83 | 84 | 85 | true 86 | 87 | 90 | true 91 | 92 | 93 | 5 94 | 95 | 96 | true 97 | 98 | 99 | false 100 | 101 | 113 | true 114 | 115 | 116 | 118 | true 119 | 120 | 126 | 1 127 | 128 | 129 | true 130 | 131 | 137 | 1 138 | 139 | 140 | -------------------------------------------------------------------------------- /overlay/aosp/frameworks/base/core/res/res/xml/power_profile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4000 4 | 5 | -------------------------------------------------------------------------------- /overlay/aosp/frameworks/base/packages/SettingsProvider/res/values/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | false 7 | 8 | 9 | -------------------------------------------------------------------------------- /overlay/aosp/frameworks/base/packages/SystemUI/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | true 7 | 8 | false 9 | 10 | true 11 | 12 | false 13 | true 14 | 15 | 19 | false 20 | 21 | 22 | -------------------------------------------------------------------------------- /overlay/aosp/packages/apps/Settings/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | false 21 | true 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /overlay/aosp/packages/apps/Settings/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | About Retroid Pocket 7 | About Retroid Pocket 8 | 9 | 10 | -------------------------------------------------------------------------------- /overlay/lineage/lineage-sdk/lineage/res/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 0 19 | 20 | 34 | 2 35 | 36 | 37 | -------------------------------------------------------------------------------- /patches/apply-patches.sh: -------------------------------------------------------------------------------- 1 | # We change directory into the corresponding folders of the patched items, and then use patch -p1 on them 2 | 3 | cd ../../../../ 4 | echo "Applying patches..." 5 | 6 | # Recovery patch 7 | cd bootable/recovery 8 | patch -p1 < ../../device/retroid/pocket2/patches/bootable/recovery/0001-pocket2-Fix-Items-to-Fit-on-Screen.patch 9 | patch -p1 < ../../device/retroid/pocket2/patches/bootable/recovery/0002-pocket1-Use-Back-Button-As-Down.patch 10 | cd ../../ 11 | 12 | # Build/make/core patch 13 | cd build/make/ 14 | patch -p1 < ../../device/retroid/pocket2/patches/build/make/core/fix_atv_target.patch 15 | cd ../../ 16 | 17 | # Screenshots and Power Off UI patches 18 | cd frameworks/base 19 | patch -p1 < ../../device/retroid/pocket2/patches/frameworks/base/0001-Pocket2-Fix-Screenshots.patch 20 | patch -p1 < ../../device/retroid/pocket2/patches/frameworks/base/0002-Use-Pre-Oreo-Power-Off-UI-and-add-Reboot-to-Recovery.patch 21 | patch -p1 < ../../device/retroid/pocket2/patches/frameworks/base/0003-Fix-Screen-Res-Wallpapers.patch 22 | cd ../../ 23 | 24 | # App patches 25 | cd packages/apps 26 | 27 | # Settings patch (remove encryption) 28 | cd Settings 29 | patch -p1 < ../../../device/retroid/pocket2/patches/packages/apps/Settings/0001-Remove-Encrypt-device-option-in-Settings.patch 30 | cd ../ 31 | 32 | # SetupWizard patches (remove emergency call, set double clicking home as app switcher, resize resolution to 640x480) 33 | cd SetupWizard 34 | patch -p1 < ../../../device/retroid/pocket2/patches/packages/apps/SetupWizard/0001-Remove-Emergency-Call-Option.patch 35 | cd ../ 36 | 37 | # Trebuchet patches (allow package Launcher3Go to be included and add back all apps button) 38 | cd Trebuchet 39 | patch -p1 < ../../../device/retroid/pocket2/patches/packages/apps/Trebuchet/0001-Allow-Trebuchet-and-Launcher3Go-to-coexist.patch 40 | patch -p1 < ../../../device/retroid/pocket2/patches/packages/apps/Trebuchet/0002-Use-all-apps-button-in-Trebuchet.patch 41 | cd ../ 42 | 43 | # TVSettings patches 44 | cd TvSettings 45 | patch -p1 < ../../../device/retroid/pocket2/patches/packages/apps/TvSettings/add-reboot-to-recovery.patch 46 | cd ../../.. 47 | 48 | # Remove log spam of invalid usage bits 49 | cd hardware/interfaces 50 | patch -p1 < ../../device/retroid/pocket2/patches/hardware/interfaces/0001-Ignore-Usage-Bits-Warnings.patch 51 | cd ../.. 52 | 53 | # Exit 54 | cd device/retroid/pocket2/patches 55 | echo "Done" 56 | -------------------------------------------------------------------------------- /patches/bootable/recovery/0001-pocket2-Fix-Items-to-Fit-on-Screen.patch: -------------------------------------------------------------------------------- 1 | Subject: [PATCH] pocket2 Fix Items to Fit on Screen * Due to the LCM being 2 | larger than the actual screen, it is necessary to do the following to get the 3 | screen in proper position. First, the graphics frame buffer must be set to 4 | 640 width, 480 height to match the actual screen. Next, we need to set the 5 | overscan y value to 160, so that the graphics buffer is written to (0,160), 6 | which corresponds to where the actual screen starts at. This fits the whole 7 | image properly on screen. 8 | 9 | Change-Id: I048a59ad724f1f6c88bef75e48a9de90376603b6 10 | --- 11 | minui/graphics.cpp | 12 ++++++++---- 12 | 1 file changed, 8 insertions(+), 4 deletions(-) 13 | 14 | diff --git a/minui/graphics.cpp b/minui/graphics.cpp 15 | index e9c2699d..92ef1232 100644 16 | --- a/minui/graphics.cpp 17 | +++ b/minui/graphics.cpp 18 | @@ -34,7 +34,7 @@ static MinuiBackend* gr_backend = nullptr; 19 | 20 | static int overscan_percent = OVERSCAN_PERCENT; 21 | static int overscan_offset_x = 0; 22 | -static int overscan_offset_y = 0; 23 | +static int overscan_offset_y = 160; 24 | 25 | static unsigned char gr_current_r = 255; 26 | static unsigned char gr_current_g = 255; 27 | @@ -350,7 +350,9 @@ int gr_init() { 28 | gr_backend = backend.release(); 29 | 30 | overscan_offset_x = gr_draw->width * overscan_percent / 100; 31 | - overscan_offset_y = gr_draw->height * overscan_percent / 100; 32 | + //overscan_offset_y = gr_draw->height * overscan_percent / 100; 33 | + // statically set offset to our needed one 34 | + overscan_offset_y = 160; 35 | 36 | gr_flip(); 37 | gr_flip(); 38 | @@ -363,11 +365,13 @@ void gr_exit() { 39 | } 40 | 41 | int gr_fb_width() { 42 | - return gr_draw->width - 2 * overscan_offset_x; 43 | + //return gr_draw->width - 2 * overscan_offset_x; 44 | + return 640; 45 | } 46 | 47 | int gr_fb_height() { 48 | - return gr_draw->height - 2 * overscan_offset_y; 49 | + //return gr_draw->height - 2 * overscan_offset_y; 50 | + return 480; 51 | } 52 | 53 | void gr_fb_blank(bool blank) { 54 | -- 55 | 2.25.1 56 | 57 | -------------------------------------------------------------------------------- /patches/bootable/recovery/0002-pocket1-Use-Back-Button-As-Down.patch: -------------------------------------------------------------------------------- 1 | Subject: [PATCH] pocket1 Use Back Button As Down on Pocket1 2 | * on the pocket1, the volume down buttons is unusually registered as the 3 | back button. In Android, this is worked around by changing it in the kl 4 | file. So modify Lineage recovery make the back button do the same as the 5 | volume down button. 6 | 7 | diff --git a/device.cpp b/device.cpp 8 | index 13eb7d2b..47fbda55 100644 9 | --- a/device.cpp 10 | +++ b/device.cpp 11 | @@ -156,6 +156,7 @@ int Device::HandleMenuKey(int key, bool visible) { 12 | case KEY_DOWN: 13 | case KEY_VOLUMEDOWN: 14 | case KEY_MENU: 15 | + case KEY_BACK: 16 | return kHighlightDown; 17 | 18 | case KEY_LEFTSHIFT: 19 | @@ -175,7 +176,6 @@ int Device::HandleMenuKey(int key, bool visible) { 20 | return kGoHome; 21 | 22 | case KEY_BACKSPACE: 23 | - case KEY_BACK: 24 | return kGoBack; 25 | 26 | case KEY_REFRESH: 27 | 28 | -------------------------------------------------------------------------------- /patches/build/make/core/fix_atv_target.patch: -------------------------------------------------------------------------------- 1 | diff --git a/core/product_config.mk b/core/product_config.mk 2 | index bcab7a384..6c174e791 100644 3 | --- a/core/product_config.mk 4 | +++ b/core/product_config.mk 5 | @@ -171,6 +171,7 @@ include $(BUILD_SYSTEM)/device.mk 6 | # A Lineage build needs only the Lineage product makefiles. 7 | ifneq ($(LINEAGE_BUILD),) 8 | all_product_configs := $(shell find device -path "*/$(LINEAGE_BUILD)/lineage.mk") 9 | + all_product_configs += $(shell find device -path "*/pocket2/lineage_$(LINEAGE_BUILD).mk") 10 | all_product_configs += $(wildcard vendor/lineage/build/target/product/lineage_$(LINEAGE_BUILD).mk) 11 | else 12 | ifneq ($(strip $(TARGET_BUILD_APPS)),) 13 | 14 | -------------------------------------------------------------------------------- /patches/frameworks/base/0001-Pocket2-Fix-Screenshots.patch: -------------------------------------------------------------------------------- 1 | Subject: [PATCH] Pocket2 Fix Screenshots * On Pocket2, the LCM resolution 2 | being 640x800, while the actual screen being 640x480 has weird effects on 3 | screenshots. It causes screenshots to appear as 640x800 images squished down 4 | to 640x480, resulting in blurry, inaccurate screenshots. This patch makes it 5 | so it takes the screenshot at LCM resolution (640x800) and then crops it to 6 | 640x480 at the y value of 160 (where the 640x480 screen actually starts). 7 | This will make it so screenshots will come out exactly like how the thing 8 | screenshotted appears on screen. 9 | 10 | Change-Id: Ia91e20c2a987ed024800781ace6fef1080319e77 11 | --- 12 | .../systemui/screenshot/GlobalScreenshot.java | 26 ++++++++++++------- 13 | 1 file changed, 16 insertions(+), 10 deletions(-) 14 | 15 | diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java 16 | index 5aa9561258b..226190adb5e 100644 17 | --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java 18 | +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java 19 | @@ -551,7 +551,7 @@ class GlobalScreenshot { 20 | 21 | // Scale has to account for both sides of the bg 22 | mBgPadding = (float) r.getDimensionPixelSize(R.dimen.global_screenshot_bg_padding); 23 | - mBgPaddingScale = mBgPadding / mDisplayMetrics.widthPixels; 24 | + mBgPaddingScale = mBgPadding / 640; 25 | 26 | // determine the optimal preview size 27 | int panelWidth = 0; 28 | @@ -561,7 +561,7 @@ class GlobalScreenshot { 29 | } 30 | if (panelWidth <= 0) { 31 | // includes notification_panel_width==match_parent (-1) 32 | - panelWidth = mDisplayMetrics.widthPixels; 33 | + panelWidth = 640; 34 | } 35 | mPreviewWidth = panelWidth; 36 | mPreviewHeight = r.getDimensionPixelSize(R.dimen.notification_max_height); 37 | @@ -612,7 +612,8 @@ class GlobalScreenshot { 38 | // We need to orient the screenshot correctly (and the Surface api seems to take screenshots 39 | // only in the natural orientation of the device :!) 40 | mDisplay.getRealMetrics(mDisplayMetrics); 41 | - float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels}; 42 | + // statically set to lcm resolution 43 | + float[] dims = {640, 800}; 44 | float degrees = getDegreesForRotation(mDisplay.getRotation()); 45 | boolean requiresRotation = (degrees > 0); 46 | if (requiresRotation) { 47 | @@ -635,8 +636,8 @@ class GlobalScreenshot { 48 | 49 | if (requiresRotation) { 50 | // Rotate the screenshot to the current orientation 51 | - Bitmap ss = Bitmap.createBitmap(mDisplayMetrics.widthPixels, 52 | - mDisplayMetrics.heightPixels, Bitmap.Config.ARGB_8888, 53 | + Bitmap ss = Bitmap.createBitmap(640, 54 | + 800, Bitmap.Config.ARGB_8888, 55 | mScreenBitmap.hasAlpha(), mScreenBitmap.getColorSpace()); 56 | Canvas c = new Canvas(ss); 57 | c.translate(ss.getWidth() / 2, ss.getHeight() / 2); 58 | @@ -648,27 +649,32 @@ class GlobalScreenshot { 59 | mScreenBitmap.recycle(); 60 | mScreenBitmap = ss; 61 | } 62 | + // Crop from 640x800 to 640x480 63 | + Bitmap cropped = Bitmap.createBitmap(mScreenBitmap, 0, 160, 640, 480); 64 | + mScreenBitmap.recycle(); 65 | + mScreenBitmap = cropped; 66 | 67 | - if (width != mDisplayMetrics.widthPixels || height != mDisplayMetrics.heightPixels) { 68 | + // We already have to crop it unfortunately 69 | + /*if (width != 640 || height != 800) { 70 | // Crop the screenshot to selected region 71 | Bitmap cropped = Bitmap.createBitmap(mScreenBitmap, x, y, width, height); 72 | mScreenBitmap.recycle(); 73 | mScreenBitmap = cropped; 74 | - } 75 | + }*/ 76 | 77 | // Optimizations 78 | mScreenBitmap.setHasAlpha(false); 79 | mScreenBitmap.prepareToDraw(); 80 | 81 | // Start the post-screenshot animation 82 | - startAnimation(finisher, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels, 83 | + startAnimation(finisher, 640, 480, 84 | statusBarVisible, navBarVisible); 85 | } 86 | 87 | void takeScreenshot(Runnable finisher, boolean statusBarVisible, boolean navBarVisible) { 88 | mDisplay.getRealMetrics(mDisplayMetrics); 89 | - takeScreenshot(finisher, statusBarVisible, navBarVisible, 0, 0, mDisplayMetrics.widthPixels, 90 | - mDisplayMetrics.heightPixels); 91 | + takeScreenshot(finisher, statusBarVisible, navBarVisible, 0, 0, 640, 92 | + 800); 93 | } 94 | 95 | /** 96 | -- 97 | 2.25.1 98 | 99 | -------------------------------------------------------------------------------- /patches/frameworks/base/0002-Use-Pre-Oreo-Power-Off-UI-and-add-Reboot-to-Recovery.patch: -------------------------------------------------------------------------------- 1 | Subject: [PATCH] Use Pre-Oreo Power Off UI and add Reboot to Recovery to Main 2 | Options * The Power Off UI (Global Actions menu) in Oreo is not very 3 | controller friendly. As a result, we revert back to the older UI (based on 4 | this commit 5 | https://github.com/LineageOS/android_frameworks_base/commit/16fbd9dd1d2d407aa0bc096800af2630c218cde8 6 | ). Also, add the Reboot to Recovery option to the main power off menu to make 7 | it easier to access. 8 | 9 | Change-Id: I6a9da2b5006342c557a02a90544f48d86c49abce 10 | --- 11 | .../globalactions/GlobalActionsDialog.java | 133 ++++++++++++++---- 12 | 1 file changed, 102 insertions(+), 31 deletions(-) 13 | 14 | diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java 15 | index a3fe7412926..682422f7407 100644 16 | --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java 17 | +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java 18 | @@ -116,6 +116,14 @@ import java.util.ArrayList; 19 | import java.util.BitSet; 20 | import java.util.List; 21 | 22 | +// Legacy power menu 23 | +import com.android.internal.app.AlertController; 24 | +import com.android.internal.app.AlertController.AlertParams; 25 | +import android.os.Bundle; 26 | +import android.util.TypedValue; 27 | +import android.view.KeyEvent; 28 | +import android.widget.ListView; 29 | + 30 | /** 31 | * Helper to show the global actions dialog. Each item is an {@link Action} that 32 | * may show depending on whether the keyguard is showing, and whether the device 33 | @@ -414,6 +422,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 34 | if (!mIsRestartMenu) { 35 | mItems.add(new PowerAction()); 36 | mItems.add(new RestartAction()); 37 | + mItems.add(new RestartRecoveryAction()); 38 | } 39 | 40 | ArraySet addedKeys = new ArraySet(); 41 | @@ -480,7 +489,14 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 42 | 43 | mAdapter = new MyAdapter(); 44 | 45 | - OnItemLongClickListener onItemLongClickListener = new OnItemLongClickListener() { 46 | + AlertParams params = new AlertParams(mContext); 47 | + params.mAdapter = mAdapter; 48 | + params.mOnClickListener = this; 49 | + params.mForceInverseBackground = true; 50 | + 51 | + ActionsDialog dialog = new ActionsDialog(mContext, params); 52 | + 53 | + /*OnItemLongClickListener onItemLongClickListener = new OnItemLongClickListener() { 54 | @Override 55 | public boolean onItemLongClick(AdapterView parent, View view, int position, 56 | long id) { 57 | @@ -492,9 +508,25 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 58 | return false; 59 | } 60 | }; 61 | - ActionsDialog dialog = new ActionsDialog(mContext, this, mAdapter, onItemLongClickListener); 62 | + ActionsDialog dialog = new ActionsDialog(mContext, this, mAdapter, onItemLongClickListener);*/ 63 | dialog.setCanceledOnTouchOutside(false); // Handled by the custom class. 64 | - dialog.setKeyguardShowing(mKeyguardShowing); 65 | + //dialog.setKeyguardShowing(mKeyguardShowing); 66 | + 67 | + dialog.getListView().setItemsCanFocus(true); 68 | + dialog.getListView().setLongClickable(true); 69 | + dialog.getListView().setOnItemLongClickListener( 70 | + new AdapterView.OnItemLongClickListener() { 71 | + @Override 72 | + public boolean onItemLongClick(AdapterView parent, View view, int position, 73 | + long id) { 74 | + final Action action = mAdapter.getItem(position); 75 | + if (action instanceof LongPressAction) { 76 | + return ((LongPressAction) action).onLongPress(); 77 | + } 78 | + return false; 79 | + } 80 | + }); 81 | + dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); 82 | 83 | dialog.setOnDismissListener(this); 84 | 85 | @@ -1112,11 +1144,12 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 86 | 87 | public View getView(int position, View convertView, ViewGroup parent) { 88 | Action action = getItem(position); 89 | - View view = action.create(mContext, convertView, parent, LayoutInflater.from(mContext)); 90 | + /*View view = action.create(mContext, convertView, parent, LayoutInflater.from(mContext)); 91 | if (position == 2 && !mIsRestartMenu) { 92 | HardwareUiLayout.get(parent).setDivisionView(view); 93 | } 94 | - return view; 95 | + return view;*/ 96 | + return action.create(mContext, convertView, parent, LayoutInflater.from(mContext)); 97 | } 98 | } 99 | 100 | @@ -1211,7 +1244,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 101 | 102 | public View create( 103 | Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { 104 | - View v = inflater.inflate(com.android.systemui.R.layout.global_actions_item, parent, 105 | + View v = inflater.inflate(R.layout.global_actions_item, parent, 106 | false); 107 | 108 | ImageView icon = (ImageView) v.findViewById(R.id.icon); 109 | @@ -1605,20 +1638,23 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 110 | ColorExtractor.OnColorsChangedListener { 111 | 112 | private final Context mContext; 113 | + private final AlertController mAlert; 114 | private final MyAdapter mAdapter; 115 | - private final LinearLayout mListView; 116 | - private final HardwareUiLayout mHardwareLayout; 117 | - private final OnClickListener mClickListener; 118 | - private final OnItemLongClickListener mLongClickListener; 119 | - private final GradientDrawable mGradientDrawable; 120 | - private final ColorExtractor mColorExtractor; 121 | - private boolean mKeyguardShowing; 122 | - 123 | - public ActionsDialog(Context context, OnClickListener clickListener, MyAdapter adapter, 124 | + //private final LinearLayout mListView; 125 | + //private final HardwareUiLayout mHardwareLayout; 126 | + //private final OnClickListener mClickListener; 127 | + //private final OnItemLongClickListener mLongClickListener; 128 | + //private final GradientDrawable mGradientDrawable; 129 | + //private final ColorExtractor mColorExtractor; 130 | + //private boolean mKeyguardShowing; 131 | + 132 | + /*public ActionsDialog(Context context, OnClickListener clickListener, MyAdapter adapter, 133 | OnItemLongClickListener longClickListener) { 134 | - super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions); 135 | + super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);*/ 136 | + public ActionsDialog(Context context, AlertParams params) { 137 | + super(context, getDialogTheme(context)); 138 | mContext = context; 139 | - mAdapter = adapter; 140 | + /*mAdapter = adapter; 141 | mClickListener = clickListener; 142 | mLongClickListener = longClickListener; 143 | mGradientDrawable = new GradientDrawable(mContext); 144 | @@ -1641,10 +1677,19 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 145 | setContentView(com.android.systemui.R.layout.global_actions_wrapped); 146 | mListView = findViewById(android.R.id.list); 147 | mHardwareLayout = HardwareUiLayout.get(mListView); 148 | - mHardwareLayout.setOutsideTouchListener(view -> dismiss()); 149 | + mHardwareLayout.setOutsideTouchListener(view -> dismiss());*/ 150 | + mAlert = AlertController.create(mContext, this, getWindow()); 151 | + mAdapter = (MyAdapter) params.mAdapter; 152 | + params.apply(mAlert); 153 | } 154 | 155 | - private void updateList() { 156 | + private static int getDialogTheme(Context context) { 157 | + TypedValue outValue = new TypedValue(); 158 | + context.getTheme().resolveAttribute(R.attr.alertDialogTheme, 159 | + outValue, true); 160 | + return outValue.resourceId; } 161 | + 162 | + /*private void updateList() { 163 | mListView.removeAllViews(); 164 | for (int i = 0; i < mAdapter.getCount(); i++) { 165 | View v = mAdapter.getView(i, null, mListView); 166 | @@ -1654,34 +1699,38 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 167 | mLongClickListener.onItemLongClick(null, v, pos, 0)); 168 | mListView.addView(v); 169 | } 170 | - } 171 | + }*/ 172 | 173 | @Override 174 | protected void onStart() { 175 | super.setCanceledOnTouchOutside(true); 176 | super.onStart(); 177 | - updateList(); 178 | + //updateList(); 179 | 180 | - Point displaySize = new Point(); 181 | + /*Point displaySize = new Point(); 182 | mContext.getDisplay().getRealSize(displaySize); 183 | mColorExtractor.addOnColorsChangedListener(this); 184 | mGradientDrawable.setScreenSize(displaySize.x, displaySize.y); 185 | GradientColors colors = getDarkGradientColor( 186 | mColorExtractor.getColors(mKeyguardShowing ? 187 | WallpaperManager.FLAG_LOCK : WallpaperManager.FLAG_SYSTEM)); 188 | - mGradientDrawable.setColors(colors, false); 189 | + mGradientDrawable.setColors(colors, false);*/ 190 | } 191 | 192 | + public ListView getListView() { 193 | + return mAlert.getListView(); 194 | + 195 | + } 196 | @Override 197 | protected void onStop() { 198 | super.onStop(); 199 | - mColorExtractor.removeOnColorsChangedListener(this); 200 | + //mColorExtractor.removeOnColorsChangedListener(this); 201 | } 202 | 203 | @Override 204 | public void show() { 205 | super.show(); 206 | - mGradientDrawable.setAlpha(0); 207 | + /*mGradientDrawable.setAlpha(0); 208 | mHardwareLayout.setTranslationX(getAnimTranslation()); 209 | mHardwareLayout.setAlpha(0); 210 | mHardwareLayout.animate() 211 | @@ -1695,10 +1744,16 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 212 | mGradientDrawable.setAlpha(alpha); 213 | }) 214 | .withEndAction(() -> getWindow().getDecorView().requestAccessibilityFocus()) 215 | - .start(); 216 | + .start();*/ 217 | } 218 | 219 | @Override 220 | + protected void onCreate(Bundle savedInstanceState) { 221 | + super.onCreate(savedInstanceState); 222 | + mAlert.installContent(); 223 | + } 224 | + 225 | + /*@Override 226 | public void dismiss() { 227 | mHardwareLayout.setTranslationX(0); 228 | mHardwareLayout.setAlpha(1); 229 | @@ -1719,7 +1774,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 230 | private float getAnimTranslation() { 231 | return getContext().getResources().getDimension( 232 | com.android.systemui.R.dimen.global_actions_panel_width) / 2; 233 | - } 234 | + }*/ 235 | 236 | @Override 237 | public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { 238 | @@ -1735,9 +1790,25 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 239 | return super.dispatchPopulateAccessibilityEvent(event); 240 | } 241 | 242 | + @Override 243 | + public boolean onKeyDown(int keyCode, KeyEvent event) { 244 | + if (mAlert.onKeyDown(keyCode, event)) { 245 | + return true; 246 | + } 247 | + return super.onKeyDown(keyCode, event); 248 | + } 249 | + 250 | + @Override 251 | + public boolean onKeyUp(int keyCode, KeyEvent event) { 252 | + if (mAlert.onKeyUp(keyCode, event)) { 253 | + return true; 254 | + } 255 | + return super.onKeyUp(keyCode, event); 256 | + } 257 | + 258 | @Override 259 | public void onColorsChanged(ColorExtractor extractor, int which) { 260 | - if (mKeyguardShowing) { 261 | + /*if (mKeyguardShowing) { 262 | if ((WallpaperManager.FLAG_LOCK & which) != 0) { 263 | mGradientDrawable.setColors(getDarkGradientColor( 264 | extractor.getColors(WallpaperManager.FLAG_LOCK))); 265 | @@ -1747,7 +1818,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 266 | mGradientDrawable.setColors(getDarkGradientColor( 267 | extractor.getColors(WallpaperManager.FLAG_SYSTEM))); 268 | } 269 | - } 270 | + }*/ 271 | } 272 | 273 | private GradientColors getDarkGradientColor(GradientColors fromWallpaper) { 274 | @@ -1758,8 +1829,8 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn 275 | return colors; 276 | } 277 | 278 | - public void setKeyguardShowing(boolean keyguardShowing) { 279 | + /*public void setKeyguardShowing(boolean keyguardShowing) { 280 | mKeyguardShowing = keyguardShowing; 281 | - } 282 | + }*/ 283 | } 284 | } 285 | -- 286 | 2.25.1 287 | 288 | -------------------------------------------------------------------------------- /patches/frameworks/base/0003-Fix-Screen-Res-Wallpapers.patch: -------------------------------------------------------------------------------- 1 | diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java 2 | index db994d087d8..4ea4d2f6cf6 100644 3 | --- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java 4 | +++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java 5 | @@ -571,8 +571,15 @@ public class ImageWallpaper extends WallpaperService { 6 | Log.d(TAG, "Redrawing: left=" + left + ", top=" + top); 7 | } 8 | 9 | - final float right = left + mBackground.getWidth() * mScale; 10 | - final float bottom = top + mBackground.getHeight() * mScale; 11 | + float right = left + mBackground.getWidth() * mScale; 12 | + float bottom = top + mBackground.getHeight() * mScale; 13 | + // Pocket1 / Pocket2, check if background width reports as 853 (what backgrounds of the same resolution as the screen report as) 14 | + if (mBackground.getWidth() == 853 && mBackground.getHeight() == 640){ 15 | + // Return modified positioning 16 | + top += 80; 17 | + right = left + 640 * mScale; 18 | + bottom = top + 480 * mScale; 19 | + } 20 | if (w < 0 || h < 0) { 21 | c.save(Canvas.CLIP_SAVE_FLAG); 22 | c.clipRect(left, top, right, bottom, 23 | 24 | -------------------------------------------------------------------------------- /patches/hardware/interfaces/0001-Ignore-Usage-Bits-Warnings.patch: -------------------------------------------------------------------------------- 1 | Subject: [PATCH] Ignore Usage Bits Warnings 2 | 3 | Change-Id: If1e010de32d2fc2febb3c8c5b450cf18d1d1cb70 4 | --- 5 | graphics/mapper/2.0/default/GrallocMapper.cpp | 5 +++-- 6 | 1 file changed, 3 insertions(+), 2 deletions(-) 7 | 8 | diff --git a/graphics/mapper/2.0/default/GrallocMapper.cpp b/graphics/mapper/2.0/default/GrallocMapper.cpp 9 | index d16143da..a7864669 100644 10 | --- a/graphics/mapper/2.0/default/GrallocMapper.cpp 11 | +++ b/graphics/mapper/2.0/default/GrallocMapper.cpp 12 | @@ -105,8 +105,9 @@ bool GrallocMapper::validateDescriptorInfo( 13 | 14 | if (descriptorInfo.usage & ~validUsageBits) { 15 | // could not fail as gralloc may use the reserved bits... 16 | - ALOGW("buffer descriptor with invalid usage bits 0x%" PRIx64, 17 | - descriptorInfo.usage & ~validUsageBits); 18 | + // We don't need this to constantly spam the logs, so just comment it out 19 | + //ALOGW("buffer descriptor with invalid usage bits 0x%" PRIx64, 20 | + // descriptorInfo.usage & ~validUsageBits); 21 | } 22 | 23 | return true; 24 | -- 25 | 2.25.1 26 | 27 | -------------------------------------------------------------------------------- /patches/packages/apps/Settings/0001-Remove-Encrypt-device-option-in-Settings.patch: -------------------------------------------------------------------------------- 1 | Subject: [PATCH] Remove Encrypt device option in Settings 2 | 3 | Change-Id: I91a5f15d8307143ccaa6534561570cb804260679 4 | --- 5 | AndroidManifest.xml | 4 ++-- 6 | src/com/android/settings/EncryptionAndCredential.java | 8 ++++---- 7 | 2 files changed, 6 insertions(+), 6 deletions(-) 8 | 9 | diff --git a/AndroidManifest.xml b/AndroidManifest.xml 10 | index 5615594fea..21b6eb94df 100644 11 | --- a/AndroidManifest.xml 12 | +++ b/AndroidManifest.xml 13 | @@ -2391,7 +2391,7 @@ 14 | /> 15 | 16 | 17 | - 20 | 21 | 22 | @@ -2403,7 +2403,7 @@ 23 | 24 | 26 | - 27 | + --> 28 | 29 | Restart 7 | 8 | Shutdown 9 | + 10 | + Reboot to Recovery 11 | 12 | Legal information 13 | 14 | @@ -935,6 +937,8 @@ 15 | To update this setting, your device needs to be restarted 16 | 17 | Shutdown now? 18 | + 19 | + Reboot to Recovery now? 20 | 21 | Never check 22 | 23 | diff --git a/Settings/res/xml/device_info_settings.xml b/Settings/res/xml/device_info_settings.xml 24 | index aabb6773..2cb7c0f8 100644 25 | --- a/Settings/res/xml/device_info_settings.xml 26 | +++ b/Settings/res/xml/device_info_settings.xml 27 | @@ -46,6 +46,10 @@ 28 | android:title="@string/shutdown_button_label" 29 | android:fragment="com.android.tv.settings.about.ShutdownConfirmFragment" /> 30 | 31 | + 34 | + 35 | 36 | actions, 104 | + Bundle savedInstanceState) { 105 | + final Context context = getActivity(); 106 | + actions.add(new GuidedAction.Builder(context) 107 | + .id(GuidedAction.ACTION_ID_OK) 108 | + .title(R.string.reboot_to_recovery_button_label) 109 | + .build()); 110 | + actions.add(new GuidedAction.Builder(context) 111 | + .clickAction(GuidedAction.ACTION_ID_CANCEL) 112 | + .build()); 113 | + } 114 | + 115 | + @Override 116 | + public void onGuidedActionClicked(GuidedAction action) { 117 | + if (action.getId() == GuidedAction.ACTION_ID_OK) { 118 | + final PowerManager pm = 119 | + (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE); 120 | + 121 | + new AsyncTask() { 122 | + @Override 123 | + protected Void doInBackground(Void... params) { 124 | + pm.reboot("recovery"); 125 | + return null; 126 | + } 127 | + }.execute(); 128 | + } else { 129 | + getFragmentManager().popBackStack(); 130 | + } 131 | + } 132 | +} 133 | -------------------------------------------------------------------------------- /patches/remove-patches.sh: -------------------------------------------------------------------------------- 1 | # Git reset all affected folders 2 | 3 | cd ../../../../ 4 | 5 | # Recovery 6 | cd bootable/recovery 7 | git reset --hard 8 | cd ../../ 9 | 10 | # Build/make/core 11 | cd build/make/core 12 | git reset --hard 13 | cd ../../.. 14 | 15 | # Frameworks/base 16 | cd frameworks/base 17 | git reset --hard 18 | cd ../../ 19 | 20 | # Settings 21 | cd packages/apps/Settings 22 | git reset --hard 23 | cd ../ 24 | 25 | # SetupWizard 26 | cd SetupWizard 27 | git reset --hard 28 | cd ../ 29 | 30 | # Trebuchet 31 | cd Trebuchet 32 | git reset --hard 33 | cd ../ 34 | 35 | # TvSettings 36 | cd TvSettings 37 | git reset --hard 38 | git clean -f -d 39 | cd ../ 40 | 41 | # Hardware/interfaces 42 | cd ../../hardware/interfaces 43 | git reset --hard 44 | cd ../.. 45 | 46 | # Exit 47 | cd device/retroid/pocket2/patches 48 | -------------------------------------------------------------------------------- /prebuilt/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) -------------------------------------------------------------------------------- /prebuilt/Launcher3Go/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := Launcher3Go 5 | LOCAL_SRC_FILES := Launcher3Go.apk 6 | LOCAL_CERTIFICATE := PRESIGNED 7 | LOCAL_MODULE_CLASS := APPS 8 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 9 | LOCAL_MODULE_PATH := $(TARGET_OUT)/priv-app 10 | include $(BUILD_PREBUILT) 11 | -------------------------------------------------------------------------------- /prebuilt/Launcher3Go/Launcher3Go.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turtleletortue/android_device_retroid_pocket2/6a2dbe6df72434a3ae7a0f2bc9c6f538a2e5081e/prebuilt/Launcher3Go/Launcher3Go.apk -------------------------------------------------------------------------------- /prebuilt/RePoLa/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := RePoLa 5 | LOCAL_SRC_FILES := launcher-release.apk 6 | LOCAL_CERTIFICATE := PRESIGNED 7 | LOCAL_MODULE_CLASS := APPS 8 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 9 | LOCAL_MODULE_PATH := $(TARGET_OUT)/app 10 | include $(BUILD_PREBUILT) 11 | -------------------------------------------------------------------------------- /prebuilt/RsMappingLite/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := RsMappingLite 5 | LOCAL_SRC_FILES := RsMappingLite.apk 6 | LOCAL_CERTIFICATE := PRESIGNED 7 | LOCAL_MODULE_CLASS := APPS 8 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 9 | LOCAL_MODULE_PATH := $(TARGET_OUT)/app 10 | include $(BUILD_PREBUILT) 11 | -------------------------------------------------------------------------------- /prebuilt/RsMappingLite/RsMappingLite.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turtleletortue/android_device_retroid_pocket2/6a2dbe6df72434a3ae7a0f2bc9c6f538a2e5081e/prebuilt/RsMappingLite/RsMappingLite.apk -------------------------------------------------------------------------------- /prebuilt/Toolbox/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := Toolbox 5 | LOCAL_SRC_FILES := Toolbox.apk 6 | LOCAL_CERTIFICATE := PRESIGNED 7 | LOCAL_MODULE_CLASS := APPS 8 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) 9 | LOCAL_MODULE_PATH := $(TARGET_OUT)/app 10 | include $(BUILD_PREBUILT) 11 | -------------------------------------------------------------------------------- /prebuilt/Toolbox/Toolbox.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turtleletortue/android_device_retroid_pocket2/6a2dbe6df72434a3ae7a0f2bc9c6f538a2e5081e/prebuilt/Toolbox/Toolbox.apk -------------------------------------------------------------------------------- /proprietary-files.txt: -------------------------------------------------------------------------------- 1 | 2 | lib/libem_audio_jni.so 3 | lib/libem_bt_jni.so 4 | lib/libem_lte_jni.so 5 | lib/libem_sensor_jni.so 6 | lib/libem_support_jni.so 7 | lib/libem_usb_jni.so 8 | lib/libem_wifi_jni.so 9 | 10 | bin/dm_agent_binder 11 | etc/init/dm_agent_binder.rc 12 | lib/libcustom_prop.so 13 | 14 | bin/thermald 15 | etc/init/init.thermald.rc 16 | lib/libhwm_mtk.so 17 | lib/libsysenv_system.so 18 | lib/libfile_op_mtk.so 19 | lib/libcustom_nvram_mtk.so 20 | 21 | 22 | bin/audiocmdservice_atci 23 | etc/init/audiocmdservice_atci.rc 24 | 25 | bin/storagemanagerd 26 | etc/init/storagemanagerd.rc 27 | 28 | lib/vendor.mediatek.hardware.pq@2.0.so 29 | lib/vendor.mediatek.hardware.nvram@1.0.so 30 | 31 | # Power 32 | #lib64/vendor.mediatek.hardware.power@1.1.so 33 | #lib/vendor.mediatek.hardware.power@1.1.so 34 | 35 | # Kernel Power Off Charging (KPOC) 36 | bin/kpoc_charger 37 | etc/init/kpoc_charger.rc 38 | 39 | # Bluetooth 40 | etc/bluetooth/mtk_bt_fw.conf 41 | etc/bluetooth/mtk_bt_stack.conf 42 | 43 | # GED 44 | bin/ged_srv 45 | etc/init/ged_srv.rc 46 | lib/libged_sys.so 47 | lib/libged_kpi.so 48 | 49 | # Graphics 50 | lib/libgralloc_extra_sys.so 51 | 52 | lib/libui_ext_fwk.so 53 | 54 | lib/libmtkavenhancements.so 55 | lib/libmtklimiter.so 56 | lib/libmtkshifter.so 57 | 58 | lib/libpq_cust_mtk.so 59 | 60 | lib/libnvram_mtk.so 61 | lib/libnvram_platform_mtk.so 62 | lib/libnvram_sec_mtk.so 63 | 64 | lib/libyv12util.so 65 | lib/libxtables.so 66 | lib/libvsync_hint.so 67 | lib/libvoicerecognition.so 68 | lib/libvoicerecognition_jni.so 69 | lib/libterservice.so 70 | lib/libprogrambinary.so 71 | lib/libshowlogo.so 72 | lib/libsf_debug.so 73 | lib/libnetworklocation.so 74 | lib/libmtkbluetooth_jni.so 75 | lib/libminiui.so 76 | lib/libmediatek_exceptionlog.so 77 | lib/liblocSDK6c.so 78 | lib/libjni_pq.so 79 | lib/libja3m.so 80 | lib/libgui_debug.so 81 | lib/libdrmmtkutil.so 82 | lib/libdrmmtkwhitelist.so 83 | lib/libcustom_jni.so 84 | lib/libbluetooth_relayer_system.so 85 | lib/libbluetooth_mtk_pure_system.so 86 | lib/libbluetoothem_mtk_system.so 87 | lib/libblisrc.so 88 | lib/libblisrc32.so 89 | lib/libbessound_hd_mtk.so 90 | lib/libaudiotoolkit.so 91 | lib/libaudiopolicycustomextensions.so 92 | lib/libaudiodcrflt.so 93 | lib/libaudiocustparam.so 94 | lib/libaudiocomponentengine.so 95 | lib/libaudiocompensationfilter.so 96 | lib/libaal.so 97 | 98 | etc/wifi-apns.xml 99 | etc/usb_audio_policy_configuration.xml 100 | etc/r_submix_audio_policy_configuration.xml 101 | etc/init/terserver.rc 102 | etc/init/program_binary_service.rc 103 | lib/libaed.so 104 | etc/init/batterywarning.rc 105 | etc/default_volume_tables.xml 106 | etc/audio_policy_volumes.xml 107 | etc/audio_policy_configuration.xml 108 | etc/audio_policy_configuration_stub.xml 109 | etc/apns-conf.xml 110 | etc/a2dp_audio_policy_configuration.xml 111 | 112 | bin/tertestclient 113 | bin/terservice 114 | bin/meta_tst 115 | bin/lcdc_screen_cap 116 | bin/boot_logo_updater 117 | bin/batterywarning 118 | bin/badblocks 119 | 120 | bin/thermalindicator 121 | bin/startup.sh 122 | #bin/rtt 123 | bin/pservice:vendor/bin/pservice 124 | bin/profmand 125 | #bin/netdiag 126 | bin/mmp 127 | #bin/emdlogger1 128 | #bin/emdlogger5 129 | bin/program_binary_builder 130 | bin/program_binary_service 131 | 132 | # Include stock hwui to use patchelf with program_binary_builder for missing symbols 133 | lib/libhwui.so:lib/libhwuimtk.so 134 | 135 | lib/libvixld-arm.so 136 | lib/libvixld-arm64.so 137 | lib/libplatformadapter.so 138 | #lib/libopenjdkjvmtid.so 139 | #lib/libopenjdkjvmd.so 140 | #lib/libopenjdkd.so 141 | lib/libmrdump.so 142 | lib/libmemoryDumpEncoder.so 143 | lib/libjni_jpegstream_mtk.so 144 | lib/libjni_filtershow_filters_mtk.so 145 | lib/libjni_eglfence_mtk.so 146 | lib/libccci_util_sys.so 147 | lib/libBinderServiceP.so:vendor/lib/libBinderServiceP.so 148 | lib/libaudio-resampler.so 149 | 150 | etc/init/thermalindicator.rc 151 | #etc/init/netdiag.rc 152 | #etc/init/mdlogger.rc 153 | #etc/init/emdlogger1.rc 154 | #etc/init/emdlogger5.rc 155 | #bin/mdlogger 156 | 157 | # boot script 158 | bin/boot.sh 159 | 160 | # Keylayouts 161 | usr/keylayout/mtk-kpd.kl 162 | usr/keylayout/Vendor_2020_Product_0111.kl 163 | 164 | # Audio 165 | etc/audio_effects.conf 166 | 167 | -------------------------------------------------------------------------------- /rootdir/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | include $(CLEAR_VARS) 5 | LOCAL_MODULE := factory_init.connectivity.rc 6 | LOCAL_MODULE_TAGS := optional eng 7 | LOCAL_MODULE_CLASS := ETC 8 | LOCAL_SRC_FILES := etc/factory_init.connectivity.rc 9 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 10 | include $(BUILD_PREBUILT) 11 | 12 | include $(CLEAR_VARS) 13 | LOCAL_MODULE := factory_init.project.rc 14 | LOCAL_MODULE_TAGS := optional eng 15 | LOCAL_MODULE_CLASS := ETC 16 | LOCAL_SRC_FILES := etc/factory_init.project.rc 17 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 18 | include $(BUILD_PREBUILT) 19 | 20 | include $(CLEAR_VARS) 21 | LOCAL_MODULE := factory_init.rc 22 | LOCAL_MODULE_TAGS := optional eng 23 | LOCAL_MODULE_CLASS := ETC 24 | LOCAL_SRC_FILES := etc/factory_init.rc 25 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 26 | include $(BUILD_PREBUILT) 27 | 28 | include $(CLEAR_VARS) 29 | LOCAL_MODULE := init.connectivity.rc 30 | LOCAL_MODULE_TAGS := optional eng 31 | LOCAL_MODULE_CLASS := ETC 32 | LOCAL_SRC_FILES := etc/init.connectivity.rc 33 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 34 | include $(BUILD_PREBUILT) 35 | 36 | include $(CLEAR_VARS) 37 | LOCAL_MODULE := init.modem.rc 38 | LOCAL_MODULE_TAGS := optional eng 39 | LOCAL_MODULE_CLASS := ETC 40 | LOCAL_SRC_FILES := etc/init.modem.rc 41 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 42 | include $(BUILD_PREBUILT) 43 | 44 | include $(CLEAR_VARS) 45 | LOCAL_MODULE := init.mt6580.rc 46 | LOCAL_MODULE_TAGS := optional eng 47 | LOCAL_MODULE_CLASS := ETC 48 | LOCAL_SRC_FILES := etc/init.mt6580.rc 49 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 50 | include $(BUILD_PREBUILT) 51 | 52 | include $(CLEAR_VARS) 53 | LOCAL_MODULE := init.mt6580.usb.rc 54 | LOCAL_MODULE_TAGS := optional eng 55 | LOCAL_MODULE_CLASS := ETC 56 | LOCAL_SRC_FILES := etc/init.mt6580.usb.rc 57 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 58 | include $(BUILD_PREBUILT) 59 | 60 | include $(CLEAR_VARS) 61 | LOCAL_MODULE := init.project.rc 62 | LOCAL_MODULE_TAGS := optional eng 63 | LOCAL_MODULE_CLASS := ETC 64 | LOCAL_SRC_FILES := etc/init.project.rc 65 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 66 | include $(BUILD_PREBUILT) 67 | 68 | include $(CLEAR_VARS) 69 | LOCAL_MODULE := init.sensor_1_0.rc 70 | LOCAL_MODULE_TAGS := optional eng 71 | LOCAL_MODULE_CLASS := ETC 72 | LOCAL_SRC_FILES := etc/init.sensor_1_0.rc 73 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 74 | include $(BUILD_PREBUILT) 75 | 76 | include $(CLEAR_VARS) 77 | LOCAL_MODULE := meta_init.connectivity.rc 78 | LOCAL_MODULE_TAGS := optional eng 79 | LOCAL_MODULE_CLASS := ETC 80 | LOCAL_SRC_FILES := etc/meta_init.connectivity.rc 81 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 82 | include $(BUILD_PREBUILT) 83 | 84 | include $(CLEAR_VARS) 85 | LOCAL_MODULE := meta_init.modem.rc 86 | LOCAL_MODULE_TAGS := optional eng 87 | LOCAL_MODULE_CLASS := ETC 88 | LOCAL_SRC_FILES := etc/meta_init.modem.rc 89 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 90 | include $(BUILD_PREBUILT) 91 | 92 | include $(CLEAR_VARS) 93 | LOCAL_MODULE := meta_init.project.rc 94 | LOCAL_MODULE_TAGS := optional eng 95 | LOCAL_MODULE_CLASS := ETC 96 | LOCAL_SRC_FILES := etc/meta_init.project.rc 97 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 98 | include $(BUILD_PREBUILT) 99 | 100 | include $(CLEAR_VARS) 101 | LOCAL_MODULE := meta_init.rc 102 | LOCAL_MODULE_TAGS := optional eng 103 | LOCAL_MODULE_CLASS := ETC 104 | LOCAL_SRC_FILES := etc/meta_init.rc 105 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 106 | include $(BUILD_PREBUILT) 107 | 108 | include $(CLEAR_VARS) 109 | LOCAL_MODULE := multi_init.rc 110 | LOCAL_MODULE_TAGS := optional eng 111 | LOCAL_MODULE_CLASS := ETC 112 | LOCAL_SRC_FILES := etc/multi_init.rc 113 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 114 | include $(BUILD_PREBUILT) 115 | 116 | include $(CLEAR_VARS) 117 | LOCAL_MODULE := init.nvdata.rc 118 | LOCAL_MODULE_TAGS := optional eng 119 | LOCAL_MODULE_CLASS := ETC 120 | LOCAL_SRC_FILES := etc/init.nvdata.rc 121 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw 122 | include $(BUILD_PREBUILT) 123 | 124 | include $(CLEAR_VARS) 125 | LOCAL_MODULE := fstab.mt6580 126 | LOCAL_MODULE_TAGS := optional eng 127 | LOCAL_MODULE_CLASS := ETC 128 | LOCAL_SRC_FILES := etc/fstab.mt6580 129 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC) 130 | include $(BUILD_PREBUILT) 131 | 132 | include $(CLEAR_VARS) 133 | LOCAL_MODULE := ueventd.mt6580.rc 134 | LOCAL_MODULE_STEM := ueventd.rc 135 | LOCAL_MODULE_TAGS := optional eng 136 | LOCAL_MODULE_CLASS := ETC 137 | LOCAL_SRC_FILES := etc/ueventd.mt6580.rc 138 | LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR) 139 | include $(BUILD_PREBUILT) 140 | 141 | include $(CLEAR_VARS) 142 | LOCAL_MODULE := fstab.enableswap 143 | LOCAL_MODULE_TAGS := optional eng 144 | LOCAL_MODULE_CLASS := ETC 145 | LOCAL_SRC_FILES := etc/fstab.enableswap 146 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 147 | include $(BUILD_PREBUILT) 148 | 149 | -------------------------------------------------------------------------------- /rootdir/etc/factory_init.connectivity.rc: -------------------------------------------------------------------------------- 1 | on post-fs-data 2 | # 3 | # Connectivity related modules and character device nodes (Begin) 4 | # 5 | 6 | #/dev/ttyMT2 for Connectivity BT/FM/GPS usage 7 | chmod 0660 /dev/ttyMT2 8 | chown system system /dev/ttyMT2 9 | 10 | # GPS 11 | mkdir /data/gps_mnl 0771 gps system 12 | mkdir /data/misc/gps 0770 gps system 13 | chown gps gps /dev/stpgps 14 | chown gps gps /sys/class/gpsdrv/gps/pwrctl 15 | chown gps gps /sys/class/gpsdrv/gps/suspend 16 | chown gps gps /sys/class/gpsdrv/gps/state 17 | chown gps gps /sys/class/gpsdrv/gps/pwrsave 18 | chown gps gps /sys/class/gpsdrv/gps/status 19 | chmod 0660 /dev/stpgps 20 | 21 | # GPS EMI 22 | chmod 666 /dev/gps_emi 23 | 24 | # WiFi 25 | mkdir /data/misc/wifi 0770 wifi wifi 26 | mkdir /data/misc/wifi/sockets 0770 wifi wifi 27 | mkdir /data/misc/wpa_supplicant 0770 wifi wifi 28 | 29 | # 30 | # Connectivity related device nodes & configuration (end) 31 | # 32 | 33 | 34 | on boot 35 | 36 | # 37 | # Connectivity related services (Begin) 38 | # 39 | # WMT 40 | service wmt_loader /vendor/bin/wmt_loader 41 | user root 42 | group root 43 | oneshot 44 | 45 | service wmt_launcher /vendor/bin/wmt_launcher -p /vendor/firmware/ 46 | user system 47 | group system 48 | 49 | # GPS 50 | #service mnld /vendor/bin/mnld 51 | # class main 52 | # user gps 53 | # group gps inet misc sdcard_rw sdcard_r media_rw system radio 54 | # socket mnld stream 660 gps system 55 | 56 | #service BGW /vendor/bin/BGW 57 | # user system 58 | # group gps system radio 59 | # class main 60 | 61 | # 62 | # Connectivity related services (End) 63 | # 64 | 65 | # 66 | # Connectivity related kernel objects (Begin) 67 | # 68 | 69 | # load wmt_drv 70 | on boot 71 | insmod /vendor/lib/modules/wmt_drv.ko 72 | 73 | # load bt_drv 74 | on property:service.wcn.driver.ready=yes 75 | insmod /vendor/lib/modules/bt_drv.ko 76 | 77 | # load wifi chrdev driver and wlan driver after wmt_loader finish 78 | on property:service.wcn.driver.ready=yes 79 | insmod /vendor/lib/modules/wmt_chrdev_wifi.ko 80 | insmod /vendor/lib/modules/wlan_drv.ko 81 | 82 | # load fmradio_drv 83 | on property:service.wcn.driver.ready=yes 84 | insmod /vendor/lib/modules/fmradio_drv.ko 85 | setprop fmradio_drv.ko 1 86 | 87 | # load gps_drv 88 | on property:service.wcn.driver.ready=yes 89 | insmod /vendor/lib/modules/gps_drv.ko 90 | setprop gps_drv.ko 1 91 | 92 | # 93 | # Connectivity related kernel objects (End) 94 | # 95 | -------------------------------------------------------------------------------- /rootdir/etc/factory_init.project.rc: -------------------------------------------------------------------------------- 1 | mkdir /data/misc/sensors 0664 system system 2 | 3 | #service msensord /vendor/bin/msensord 4 | # user system 5 | # group system 6 | # oneshot 7 | 8 | service akmd8963 /vendor/bin/akmd8963 9 | disabled 10 | user system 11 | group system 12 | 13 | 14 | on post-fs 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | chmod 0660 /dev/spm 24 | chown system system /dev/spm 25 | 26 | on boot 27 | 28 | 29 | 30 | 31 | 32 | service spm_script /vendor/bin/spm_loader 33 | user system 34 | group system 35 | oneshot 36 | 37 | -------------------------------------------------------------------------------- /rootdir/etc/fstab.enableswap: -------------------------------------------------------------------------------- 1 | /dev/block/zram0 none swap defaults zramsize=75%,swapprio=10 2 | -------------------------------------------------------------------------------- /rootdir/etc/fstab.mt6580: -------------------------------------------------------------------------------- 1 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/system /system ext4 ro wait,recoveryonly 2 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/vendor /vendor ext4 ro wait,recoveryonly 3 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check,,resize,encryptable=/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/metadata, 4 | 5 | 6 | 7 | 8 | 9 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check 10 | 11 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/protect1 /vendor/protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable 12 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/protect2 /vendor/protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable 13 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/nvdata /vendor/nvdata ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,formattable 14 | 15 | 16 | 17 | 18 | 19 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/frp /persistent emmc defaults defaults 20 | 21 | 22 | /devices/mtk-msdc.0/11130000.msdc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata 23 | 24 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/nvram /nvram emmc defaults defaults 25 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/proinfo /proinfo emmc defaults defaults 26 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/lk /bootloader emmc defaults defaults 27 | 28 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/lk2 /bootloader2 emmc defaults defaults 29 | 30 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/para /misc emmc defaults defaults 31 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/boot /boot emmc defaults defaults 32 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/recovery /recovery emmc defaults defaults 33 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/logo /logo emmc defaults defaults 34 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/expdb /expdb emmc defaults defaults 35 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/secro /secro emmc defaults defaults 36 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/seccfg /seccfg emmc defaults defaults 37 | 38 | 39 | 40 | 41 | 42 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/odmdtbo /odmdtbo emmc defaults defaults 43 | /devices/platform/mt_usb* auto auto defaults voldmanaged=usbotg:auto 44 | -------------------------------------------------------------------------------- /rootdir/etc/init.ago.rc: -------------------------------------------------------------------------------- 1 | # ago_default is the init flow for the project > 1G 2 | 3 | on init 4 | write /sys/block/zram0/comp_algorithm lz4 5 | 6 | -------------------------------------------------------------------------------- /rootdir/etc/init.connectivity.rc: -------------------------------------------------------------------------------- 1 | # MTK connectivity .rc configure 2 | 3 | on post-fs-data 4 | 5 | 6 | # 7 | # Connectivity related device nodes & configuration (begin) 8 | # 9 | 10 | #/dev/ttyMT2 for Connectivity BT/FM/GPS usage 11 | chmod 0660 /dev/ttyMT2 12 | chown system system /dev/ttyMT2 13 | 14 | #/dev/ttyMT1 for GPS 3337 usage 15 | chmod 0660 /dev/ttyMT1 16 | chown system system /dev/ttyMT1 17 | 18 | # GPS 19 | mkdir /data/gps_mnl 0771 gps system 20 | mkdir /data/misc/gps 0770 gps system 21 | mkdir /data/mnl_flp 0771 gps system 22 | mkdir /data/mnl_gfc 0771 gps system 23 | chown gps system /data/mpe_mnl 24 | chown gps system /data/mnl_flp 25 | chown gps system /data/mnl_gfc 26 | chown gps gps /sys/class/gpsdrv/gps/pwrctl 27 | chown gps gps /sys/class/gpsdrv/gps/suspend 28 | chown gps gps /sys/class/gpsdrv/gps/state 29 | chown gps gps /sys/class/gpsdrv/gps/pwrsave 30 | chown gps gps /sys/class/gpsdrv/gps/status 31 | 32 | # GPS EMI 33 | chmod 666 /dev/gps_emi 34 | 35 | # WiFi 36 | mkdir /data/misc/wifi 0770 wifi wifi 37 | mkdir /data/misc/wifi/sockets 0770 wifi wifi 38 | mkdir /data/misc/wpa_supplicant 0770 wifi wifi 39 | 40 | # BT relayer mode used VCOM 41 | chown bluetooth bluetooth /dev/ttyGS2 42 | chmod 0660 /dev/ttyGS2 43 | 44 | # 45 | # Connectivity related device nodes & configuration (end) 46 | # 47 | 48 | 49 | on boot 50 | 51 | # 52 | # Connectivity related services (Begin) 53 | # 54 | 55 | # GPS 56 | service mnld /vendor/bin/mnld 57 | class main 58 | user gps 59 | group gps inet misc sdcard_rw sdcard_r media_rw system radio 60 | socket mnld stream 660 gps system 61 | 62 | #service BGW /vendor/bin/BGW 63 | # user system 64 | # group gps system radio 65 | # class main 66 | 67 | # Wlan 68 | service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ 69 | -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ 70 | -I/vendor/etc/wifi/wpa_supplicant_overlay.conf -N \ 71 | -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin \ 72 | -I/vendor/etc/wifi/p2p_supplicant_overlay.conf \ 73 | -O/data/misc/wifi/sockets -g@android:wpa_wlan0 74 | # we will start as root and wpa_supplicant will switch to user wifi 75 | # after setting up the capabilities required for WEXT 76 | # user wifi 77 | # group wifi inet keystore 78 | class main 79 | socket wpa_wlan0 dgram 660 wifi wifi 80 | disabled 81 | oneshot 82 | 83 | # 84 | # Connectivity related services (End) 85 | # 86 | 87 | -------------------------------------------------------------------------------- /rootdir/etc/init.modem.rc: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 The Android Open Source Project 2 | # 3 | # IMPORTANT: Do not create world writable files or directories. 4 | # This is a common source of Android security bugs. 5 | # 6 | 7 | on post-fs-data 8 | 9 | write /proc/bootprof "post-fs-data: on modem start" 10 | 11 | # Encrypt phone function 12 | setprop vold.post_fs_data_done 1 13 | 14 | 15 | on property:ril.muxreport=1 16 | start muxreport-daemon 17 | 18 | -------------------------------------------------------------------------------- /rootdir/etc/init.nvdata.rc: -------------------------------------------------------------------------------- 1 | on init 2 | #Create nvdata mount point 3 | mkdir /vendor/nvdata 0771 system system 4 | 5 | on post-fs-data 6 | # create basic filesystem structure 7 | # mkdir /vendor/nvdata 2770 root system 8 | # We chown/chmod /vendor/nvdata again so because mount is run as root + defaults 9 | chown root system /vendor/nvdata 10 | chmod 2771 /vendor/nvdata 11 | mkdir /vendor/nvdata/media 0771 media audio 12 | 13 | # Set SELinux security contexts on upgrade or policy update. 14 | restorecon_recursive /vendor/nvdata -------------------------------------------------------------------------------- /rootdir/etc/init.project.rc: -------------------------------------------------------------------------------- 1 | # MTK project .rc configure 2 | 3 | on init 4 | 5 | on post-fs-data 6 | #Camera 7 | chmod 0660 /dev/MAINAF 8 | chown system camera /dev/MAINAF 9 | 10 | chmod 0660 /dev/MAINAF2 11 | chown system camera /dev/MAINAF2 12 | 13 | chmod 0660 /dev/SUBAF 14 | chown system camera /dev/SUBAF 15 | 16 | chmod 0660 /dev/GAF001AF 17 | chown system camera /dev/GAF001AF 18 | 19 | chmod 0660 /dev/DW9714AF 20 | chown system camera /dev/DW9714AF 21 | 22 | chmod 0660 /dev/AD5820AF 23 | chown system camera /dev/AD5820AF 24 | 25 | chmod 0660 /dev/BU64745GWZAF 26 | chown system camera /dev/BU64745GWZAF 27 | #SMB 28 | chown system system /proc/smb/ScreenComm 29 | chmod 0660 /proc/smb/ScreenComm 30 | 31 | chmod 0660 /dev/spm 32 | chown system system /dev/spm 33 | 34 | on boot 35 | 36 | service pservice /vendor/bin/pservice 37 | user root 38 | group root 39 | class main 40 | seclabel u:r:pservice:s0 41 | -------------------------------------------------------------------------------- /rootdir/etc/init.sensor_1_0.rc: -------------------------------------------------------------------------------- 1 | # MTK platform .rc configure 2 | on post-fs-data 3 | # calibration 4 | mkdir /data/misc/sensor 0774 system system 5 | # Sensor 6 | chmod 0660 /dev/hwmsensor 7 | chmod 0660 /dev/msensor 8 | chmod 0660 /dev/gsensor 9 | chmod 0660 /dev/als_ps 10 | chmod 0660 /dev/gyroscope 11 | chmod 0660 /dev/aal_als 12 | chmod 0660 /dev/humidity 13 | chmod 0660 /dev/barometer 14 | chmod 0660 /dev/m_als_misc 15 | chmod 0660 /dev/m_baro_misc 16 | chmod 0660 /dev/m_hmdy_misc 17 | chmod 0660 /dev/m_ps_misc 18 | chmod 0660 /dev/m_acc_misc 19 | chmod 0660 /dev/m_mag_misc 20 | chmod 0660 /dev/m_gyro_misc 21 | chmod 0660 /dev/m_act_misc 22 | chmod 0660 /dev/m_pedo_misc 23 | chmod 0660 /dev/m_situ_misc 24 | chmod 0660 /dev/m_step_c_misc 25 | chmod 0660 /dev/m_fusion_misc 26 | chmod 0660 /dev/m_bio_misc 27 | 28 | chown system system /dev/hwmsensor 29 | chown system system /dev/msensor 30 | chown system system /dev/gsensor 31 | chown radio system /dev/als_ps 32 | chown system system /dev/gyroscope 33 | chown system system /dev/aal_als 34 | chown system system /dev/humidity 35 | chown system system /dev/barometer 36 | chown system system /dev/m_als_misc 37 | chown system system /dev/m_baro_misc 38 | chown system system /dev/m_hmdy_misc 39 | chown system system /dev/m_ps_misc 40 | chown system system /dev/m_acc_misc 41 | chown system system /dev/m_mag_misc 42 | chown system system /dev/m_gyro_misc 43 | chown system system /dev/m_act_misc 44 | chown system system /dev/m_pedo_misc 45 | chown system system /dev/m_situ_misc 46 | chown system system /dev/m_step_c_misc 47 | chown system system /dev/m_fusion_misc 48 | chown system system /dev/m_bio_misc 49 | 50 | chmod 0660 /sys/class/sensor/m_acc_misc/accenablenodata 51 | chmod 0660 /sys/class/sensor/m_acc_misc/accactive 52 | chmod 0660 /sys/class/sensor/m_acc_misc/accdelay 53 | chmod 0660 /sys/class/sensor/m_acc_misc/accbatch 54 | chmod 0660 /sys/class/sensor/m_acc_misc/accflush 55 | chmod 0660 /sys/class/sensor/m_acc_misc/acccali 56 | chown system system /sys/class/sensor/m_acc_misc/accenablenodata 57 | chown system system /sys/class/sensor/m_acc_misc/accactive 58 | chown system system /sys/class/sensor/m_acc_misc/accdelay 59 | chown system system /sys/class/sensor/m_acc_misc/accbatch 60 | chown system system /sys/class/sensor/m_acc_misc/accflush 61 | chown system system /sys/class/sensor/m_acc_misc/acccali 62 | 63 | chmod 0660 /sys/class/sensor/m_mag_misc/magactive 64 | chmod 0660 /sys/class/sensor/m_mag_misc/magdelay 65 | chmod 0660 /sys/class/sensor/m_mag_misc/magbatch 66 | chmod 0660 /sys/class/sensor/m_mag_misc/magflush 67 | chmod 0660 /sys/class/sensor/m_mag_misc/magcali 68 | chmod 0660 /sys/class/sensor/m_mag_misc/maglibinfo 69 | chown system system /sys/class/sensor/m_mag_misc/magactive 70 | chown system system /sys/class/sensor/m_mag_misc/magdelay 71 | chown system system /sys/class/sensor/m_mag_misc/magbatch 72 | chown system system /sys/class/sensor/m_mag_misc/magflush 73 | chown system system /sys/class/sensor/m_mag_misc/magcali 74 | chown system system /sys/class/sensor/m_mag_misc/maglibinfo 75 | 76 | chmod 0660 /sys/class/sensor/m_gyro_misc/gyroenablenodata 77 | chmod 0660 /sys/class/sensor/m_gyro_misc/gyroactive 78 | chmod 0660 /sys/class/sensor/m_gyro_misc/gyrodelay 79 | chmod 0660 /sys/class/sensor/m_gyro_misc/gyrobatch 80 | chmod 0660 /sys/class/sensor/m_gyro_misc/gyroflush 81 | chmod 0660 /sys/class/sensor/m_gyro_misc/gyrocali 82 | chown system system /sys/class/sensor/m_gyro_misc/gyroenablenodata 83 | chown system system /sys/class/sensor/m_gyro_misc/gyroactive 84 | chown system system /sys/class/sensor/m_gyro_misc/gyrodelay 85 | chown system system /sys/class/sensor/m_gyro_misc/gyrobatch 86 | chown system system /sys/class/sensor/m_gyro_misc/gyroflush 87 | chown system system /sys/class/sensor/m_gyro_misc/gyrocali 88 | 89 | chmod 0660 /sys/class/sensor/m_als_misc/alsactive 90 | chmod 0660 /sys/class/sensor/m_als_misc/alsdelay 91 | chmod 0660 /sys/class/sensor/m_als_misc/alsbatch 92 | chmod 0660 /sys/class/sensor/m_als_misc/alsflush 93 | chmod 0660 /sys/class/sensor/m_ps_misc/psactive 94 | chmod 0660 /sys/class/sensor/m_ps_misc/psdelay 95 | chmod 0660 /sys/class/sensor/m_ps_misc/psbatch 96 | chmod 0660 /sys/class/sensor/m_ps_misc/psflush 97 | chown system system /sys/class/sensor/m_als_misc/alsactive 98 | chown system system /sys/class/sensor/m_als_misc/alsdelay 99 | chown system system /sys/class/sensor/m_als_misc/alsbatch 100 | chown system system /sys/class/sensor/m_als_misc/alsflush 101 | chown system system /sys/class/sensor/m_ps_misc/psactive 102 | chown system system /sys/class/sensor/m_ps_misc/psdelay 103 | chown system system /sys/class/sensor/m_ps_misc/psbatch 104 | chown system system /sys/class/sensor/m_ps_misc/psflush 105 | 106 | chmod 0660 /sys/class/sensor/m_baro_misc/baroenablenodata 107 | chmod 0660 /sys/class/sensor/m_baro_misc/baroactive 108 | chmod 0660 /sys/class/sensor/m_baro_misc/barodelay 109 | chmod 0660 /sys/class/sensor/m_baro_misc/barobatch 110 | chmod 0660 /sys/class/sensor/m_baro_misc/baroflush 111 | chown system system /sys/class/sensor/m_baro_misc/baroenablenodata 112 | chown system system /sys/class/sensor/m_baro_misc/baroactive 113 | chown system system /sys/class/sensor/m_baro_misc/barodelay 114 | chown system system /sys/class/sensor/m_baro_misc/barobatch 115 | chown system system /sys/class/sensor/m_baro_misc/baroflush 116 | 117 | chmod 0660 /sys/class/sensor/m_hmdy_misc/hmdyenablenodata 118 | chmod 0660 /sys/class/sensor/m_hmdy_misc/hmdyactive 119 | chmod 0660 /sys/class/sensor/m_hmdy_misc/hmdydelay 120 | chmod 0660 /sys/class/sensor/m_hmdy_misc/hmdybatch 121 | chmod 0660 /sys/class/sensor/m_hmdy_misc/hmdyflush 122 | 123 | chown system system /sys/class/sensor/m_hmdy_misc/hmdyenablenodata 124 | chown system system /sys/class/sensor/m_hmdy_misc/hmdyactive 125 | chown system system /sys/class/sensor/m_hmdy_misc/hmdydelay 126 | chown system system /sys/class/sensor/m_hmdy_misc/hmdybatch 127 | chown system system /sys/class/sensor/m_hmdy_misc/hmdyflush 128 | 129 | chmod 0660 /sys/class/sensor/m_pedo_misc/pedoactive 130 | chmod 0660 /sys/class/sensor/m_pedo_misc/pedodelay 131 | chmod 0660 /sys/class/sensor/m_pedo_misc/pedobatch 132 | chmod 0660 /sys/class/sensor/m_pedo_misc/pedoflush 133 | chown system system /sys/class/sensor/m_pedo_misc/pedoactive 134 | chown system system /sys/class/sensor/m_pedo_misc/pedodelay 135 | chown system system /sys/class/sensor/m_pedo_misc/pedobatch 136 | chown system system /sys/class/sensor/m_pedo_misc/pedoflush 137 | 138 | chmod 0660 /sys/class/sensor/m_situ_misc/situactive 139 | chmod 0660 /sys/class/sensor/m_situ_misc/situdelay 140 | chmod 0660 /sys/class/sensor/m_situ_misc/situbatch 141 | chmod 0660 /sys/class/sensor/m_situ_misc/situflush 142 | chown system system /sys/class/sensor/m_situ_misc/situactive 143 | chown system system /sys/class/sensor/m_situ_misc/situdelay 144 | chown system system /sys/class/sensor/m_situ_misc/situbatch 145 | chown system system /sys/class/sensor/m_situ_misc/situflush 146 | 147 | chmod 0660 /sys/class/sensor/m_act_misc/actactive 148 | chmod 0660 /sys/class/sensor/m_act_misc/actdelay 149 | chmod 0660 /sys/class/sensor/m_act_misc/actbatch 150 | chmod 0660 /sys/class/sensor/m_act_misc/actflush 151 | chown system system /sys/class/sensor/m_act_misc/actactive 152 | chown system system /sys/class/sensor/m_act_misc/actdelay 153 | chown system system /sys/class/sensor/m_act_misc/actbatch 154 | chown system system /sys/class/sensor/m_act_misc/actflush 155 | 156 | chmod 0660 /sys/class/sensor/m_step_c_misc/step_cactive 157 | chmod 0660 /sys/class/sensor/m_step_c_misc/step_cdelay 158 | chmod 0660 /sys/class/sensor/m_step_c_misc/step_cbatch 159 | chmod 0660 /sys/class/sensor/m_step_c_misc/step_cflush 160 | chown system system /sys/class/sensor/m_step_c_misc/step_cactive 161 | chown system system /sys/class/sensor/m_step_c_misc/step_cdelay 162 | chown system system /sys/class/sensor/m_step_c_misc/step_cbatch 163 | chown system system /sys/class/sensor/m_step_c_misc/step_cflush 164 | 165 | chmod 0660 /sys/class/sensor/m_fusion_misc/fusionactive 166 | chmod 0660 /sys/class/sensor/m_fusion_misc/fusiondelay 167 | chmod 0660 /sys/class/sensor/m_fusion_misc/fusionbatch 168 | chmod 0660 /sys/class/sensor/m_fusion_misc/fusionflush 169 | chown system system /sys/class/sensor/m_fusion_misc/fusionactive 170 | chown system system /sys/class/sensor/m_fusion_misc/fusiondelay 171 | chown system system /sys/class/sensor/m_fusion_misc/fusionbatch 172 | chown system system /sys/class/sensor/m_fusion_misc/fusionflush 173 | 174 | chmod 0660 /sys/class/sensor/m_bio_misc/bioactive 175 | chmod 0660 /sys/class/sensor/m_bio_misc/biodelay 176 | chmod 0660 /sys/class/sensor/m_bio_misc/biobatch 177 | chmod 0660 /sys/class/sensor/m_bio_misc/bioflush 178 | chown system system /sys/class/sensor/m_bio_misc/bioactive 179 | chown system system /sys/class/sensor/m_bio_misc/biodelay 180 | chown system system /sys/class/sensor/m_bio_misc/biobatch 181 | chown system system /sys/class/sensor/m_bio_misc/bioflush 182 | -------------------------------------------------------------------------------- /rootdir/etc/meta_init.connectivity.rc: -------------------------------------------------------------------------------- 1 | #INTERNAL_START 2 | on post-fs-data 3 | # 4 | # Connectivity related modules and character device nodes (Begin) 5 | # 6 | 7 | #/dev/ttyMT2 for Connectivity BT/FM/GPS usage 8 | chmod 0660 /dev/ttyMT2 9 | chown system system /dev/ttyMT2 10 | 11 | #GPS 12 | mkdir /data/gps_mnl 0771 gps system 13 | mkdir /data/misc/gps 0770 gps system 14 | 15 | # GPS EMI 16 | chmod 666 /dev/gps_emi 17 | 18 | # 19 | # Connectivity related device nodes & configuration (end) 20 | # 21 | 22 | 23 | on boot 24 | 25 | # 26 | # Connectivity related services (Begin) 27 | # 28 | # WMT 29 | service wmt_loader /vendor/bin/wmt_loader 30 | user root 31 | group root 32 | oneshot 33 | 34 | service wmt_launcher /vendor/bin/wmt_launcher -p /vendor/firmware/ 35 | user system 36 | group system 37 | 38 | # GPS 39 | #service mnld /vendor/bin/mnld 40 | # class main 41 | # user gps 42 | # group gps inet misc sdcard_rw sdcard_r media_rw system radio 43 | # socket mnld stream 660 gps system 44 | 45 | #service BGW /vendor/bin/BGW 46 | # user system 47 | # group gps system radio 48 | # class main 49 | 50 | # 51 | # Connectivity related services (End) 52 | # 53 | 54 | # 55 | # Connectivity related kernel objects (Begin) 56 | # 57 | 58 | # load wmt_drv 59 | on boot 60 | insmod /vendor/lib/modules/wmt_drv.ko 61 | 62 | # load bt_drv 63 | on property:service.wcn.driver.ready=yes 64 | insmod /vendor/lib/modules/bt_drv.ko 65 | 66 | # load wifi chrdev driver and wlan driver after wmt_loader finish 67 | on property:service.wcn.driver.ready=yes 68 | insmod /vendor/lib/modules/wmt_chrdev_wifi.ko 69 | insmod /vendor/lib/modules/wlan_drv.ko 70 | 71 | # load fmradio_drv 72 | on property:service.wcn.driver.ready=yes 73 | insmod /vendor/lib/modules/fmradio_drv.ko 74 | setprop fmradio_drv.ko 1 75 | 76 | # load gps_drv 77 | on property:service.wcn.driver.ready=yes 78 | insmod /vendor/lib/modules/gps_drv.ko 79 | setprop gps_drv.ko 1 80 | 81 | # 82 | # Connectivity related kernel objects (End) 83 | # 84 | 85 | #INTERNAL_END 86 | -------------------------------------------------------------------------------- /rootdir/etc/meta_init.modem.rc: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 The Android Open Source Project 2 | # 3 | # IMPORTANT: Do not create world writable files or directories. 4 | # This is a common source of Android security bugs. 5 | # 6 | 7 | on post-fs-data 8 | 9 | #INTERNAL_START 10 | write /proc/bootprof "post-fs-data: on meta modem start" 11 | 12 | # Modem related device nodes 13 | mkdir /vendor/nvdata/md 0770 root system 14 | 15 | chown radio radio /sys/kernel/ccci/boot 16 | 17 | #SeLinux 18 | mkdir /data/ccci_cfg 0770 system radio 19 | restorecon /data/ccci_cfg 20 | restorecon_recursive /vendor/protect_f 21 | restorecon_recursive /vendor/protect_s 22 | 23 | # Encrypt phone function 24 | setprop vold.post_fs_data_done 1 25 | 26 | service permission_check /vendor/bin/permission_check 27 | class main 28 | user root 29 | group system radio 30 | oneshot 31 | 32 | service ccci_fsd /vendor/bin/ccci_fsd 0 33 | user radio 34 | group radio system 35 | oneshot 36 | 37 | service ccci2_fsd /vendor/bin/ccci_fsd 1 38 | user radio 39 | group radio system 40 | oneshot 41 | 42 | service ccci_mdinit /vendor/bin/ccci_mdinit 0 43 | user system 44 | group radio system 45 | oneshot 46 | 47 | service ccci2_mdinit /vendor/bin/ccci_mdinit 1 48 | user system 49 | group radio system 50 | oneshot 51 | 52 | service ccci_rpcd /vendor/bin/ccci_rpcd 0 53 | user radio 54 | group radio system 55 | oneshot 56 | 57 | service ccci2_rpcd /vendor/bin/ccci_rpcd 1 58 | user radio 59 | group radio system 60 | oneshot 61 | 62 | #INTERNAL_END 63 | -------------------------------------------------------------------------------- /rootdir/etc/meta_init.project.rc: -------------------------------------------------------------------------------- 1 | on post-fs 2 | #INTERNAL_START 3 | 4 | 5 | chmod 0660 /dev/spm 6 | chown system system /dev/spm 7 | 8 | on boot 9 | 10 | 11 | 12 | service spm_script /vendor/bin/spm_loader 13 | user system 14 | group system 15 | oneshot 16 | 17 | #INTERNAL_END 18 | -------------------------------------------------------------------------------- /rootdir/etc/multi_init.rc: -------------------------------------------------------------------------------- 1 | # import AOSP service related rc in meta mode and factory mode. 2 | # 3 | import /system/etc/init/aee_aed.rc 4 | import /system/etc/init/aee_aed64.rc 5 | import /vendor/etc/init/aee_aedv.rc 6 | import /vendor/etc/init/aee_aedv64.rc 7 | import /system/etc/init/logd.rc 8 | import /system/etc/init/logd_e.rc 9 | import /system/etc/init/logcatd.rc 10 | import /system/etc/init/vold.rc 11 | import /system/etc/init/storagemanagerd.rc 12 | import /system/etc/init/hwservicemanager.rc 13 | import /system/etc/init/mobile_log_d.rc 14 | import /vendor/etc/init/storageproxyd.rc 15 | import /vendor/etc/init/android.hardware.keymaster@3.0-service.rc 16 | import /vendor/etc/init/vendor.mediatek.hardware.keyinstall@1.0-service.rc 17 | import /vendor/etc/init/android.hardware.audio@2.0-service-mediatek.rc 18 | import /vendor/etc/init/vendor.mediatek.hardware.keymaster_attestation@1.0-service.rc 19 | import /vendor/etc/init/android.hardware.nfc@1.0-service.rc 20 | -------------------------------------------------------------------------------- /rootdir/etc/recovery.fstab: -------------------------------------------------------------------------------- 1 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/system /system ext4 ro wait,recoveryonly 2 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/vendor /vendor ext4 ro wait,recoveryonly 3 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,check,,resize,encryptable=/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/metadata, 4 | 5 | 6 | 7 | 8 | 9 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check 10 | 11 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/protect1 /vendor/protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable 12 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/protect2 /vendor/protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable 13 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/nvdata /vendor/nvdata ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,formattable 14 | 15 | 16 | 17 | 18 | 19 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/frp /persistent emmc defaults defaults 20 | 21 | 22 | /devices/mtk-msdc.0/11130000.msdc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata 23 | 24 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/nvram /nvram emmc defaults defaults 25 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/proinfo /proinfo emmc defaults defaults 26 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/lk /bootloader emmc defaults defaults 27 | 28 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/lk2 /bootloader2 emmc defaults defaults 29 | 30 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/para /misc emmc defaults defaults 31 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/boot /boot emmc defaults defaults 32 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/recovery /recovery emmc defaults defaults 33 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/logo /logo emmc defaults defaults 34 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/expdb /expdb emmc defaults defaults 35 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/secro /secro emmc defaults defaults 36 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/seccfg /seccfg emmc defaults defaults 37 | 38 | 39 | 40 | 41 | 42 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/odmdtbo /odmdtbo emmc defaults defaults 43 | /devices/platform/mt_usb* auto auto defaults voldmanaged=usbotg:auto 44 | -------------------------------------------------------------------------------- /rootdir/etc/ueventd.mt6580.rc: -------------------------------------------------------------------------------- 1 | #change partition permission 2 | /dev/block/mmcblk0 0660 root system 3 | /dev/block/mmcblk0boot0 0660 root system 4 | /dev/block/mmcblk0boot1 0660 root system 5 | /dev/misc-sd 0660 root system 6 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/misc2 0660 root system 7 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/boot 0640 root system 8 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/recovery 0640 root system 9 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/secro 0640 root system 10 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/seccfg 0660 root system 11 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/proinfo 0660 root system 12 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/otp 0640 root system 13 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/nvram 0660 root system 14 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/para 0660 root system 15 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/logo 0640 root system 16 | /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/frp 0660 root system 17 | 18 | /dev/pro_info 0660 root system 19 | /dev/otp 0640 root system 20 | /dev/nvram 0660 root system 21 | /dev/misc 0660 root system 22 | /dev/misc2 0660 root system 23 | 24 | # OTP 25 | /dev/otp 0660 system system 26 | 27 | # Connectivity 28 | /dev/stpwmt 0660 system system 29 | /dev/wmtdetect 0660 system system 30 | 31 | # BT 32 | /dev/stpbt 0660 bluetooth bluetooth 33 | 34 | # GPS 35 | /dev/stpgps 0660 gps gps 36 | /dev/gps 0660 gps system 37 | 38 | # WIFI 39 | /dev/wmtWifi 0660 wifi wifi 40 | 41 | # FMRadio 42 | /dev/fm 0666 media media 43 | 44 | # NFC 45 | /dev/msr3110 0666 root root 46 | /dev/mt6605 0660 nfc radio 47 | 48 | # MTK BTIF driver 49 | /dev/btif 0600 system system 50 | 51 | # Trusty driver 52 | /dev/trusty-ipc-dev0 0660 system keystore 53 | 54 | # RPMB (for Trusty) 55 | /dev/block/mmcblk0rpmb 0660 root system 56 | 57 | # add the read write right of ttyUSB* 58 | /dev/bus/usb/* 0660 root usb 59 | /dev/ttyUSB0 0660 radio radio 60 | /dev/ttyUSB1 0660 radio radio 61 | /dev/ttyUSB2 0660 radio radio 62 | /dev/ttyUSB3 0660 radio radio 63 | /dev/ttyUSB4 0660 radio radio 64 | 65 | # Anyone can read the logs, but if they're not in the "logs" 66 | # group, then they'll only see log entries for their UID. 67 | /dev/log/ksystem 0600 root log 68 | 69 | /dev/ccci* 0660 radio radio 70 | /dev/ttyC* 0660 radio radio 71 | /sys/kernel/ccci modem_info 0644 radio radio 72 | /sys/kernel/ccci md1_postfix 0644 radio radio 73 | /sys/kernel/ccci md2_postfix 0644 radio radio 74 | /dev/eemcs* 0660 radio radio 75 | /dev/emd* 0660 radio radio 76 | /dev/ccci_pcm_rx 0660 audio audio 77 | /dev/ccci_pcm_tx 0660 audio audio 78 | /dev/ccci_aud 0660 audio audio 79 | /dev/ccci2_aud 0660 audio audio 80 | /dev/eemcs_aud 0660 audio audio 81 | 82 | # SGX device node 83 | /dev/pvrsrvkm 0666 root root 84 | /dev/pvr_sync 0666 root root 85 | 86 | 87 | /sys/devices/platform/leds-mt65xx/leds/green delay_on 0664 system system 88 | /sys/devices/platform/leds-mt65xx/leds/green delay_off 0664 system system 89 | /sys/devices/platform/leds-mt65xx/leds/red delay_on 0664 system system 90 | /sys/devices/platform/leds-mt65xx/leds/red delay_off 0664 system system 91 | /sys/devices/platform/leds-mt65xx/leds/blue delay_on 0664 system system 92 | /sys/devices/platform/leds-mt65xx/leds/blue delay_off 0664 system system 93 | 94 | #GPIO 95 | /dev/mtgpio 0600 radio root 96 | 97 | 98 | #FOR VIA MODEM 99 | /dev/ttySDIO* 0660 radio sdcard_rw 100 | /dev/ttyRB* 0660 radio radio 101 | 102 | # Mali node 103 | /dev/mali 0666 system graphics 104 | 105 | # Change ION driver permission 106 | /dev/ion 0666 system graphics 107 | 108 | #touch 109 | /dev/touch 0660 root system 110 | /dev/hotknot 0660 root system 111 | 112 | #hang_detect 113 | /dev/RT_Monitor 0600 system system 114 | /dev/kick_powerkey 0600 system system 115 | 116 | #MTK In-House TEE 117 | /dev/ttyACM0 0660 radio radio 118 | -------------------------------------------------------------------------------- /seccomp/mediacodec.policy: -------------------------------------------------------------------------------- 1 | #Mediatek used system call 2 | getpid: 1 3 | gettid: 1 4 | sendto: 1 5 | pselect6: 1 6 | sched_getparam: 1 7 | sched_getscheduler: 1 8 | mlock: 1 9 | munlock: 1 10 | recvfrom: 1 11 | flock: 1 12 | fchownat: 1 13 | fchmodat: 1 14 | fsync: 1 15 | setsockopt: 1 16 | -------------------------------------------------------------------------------- /seccomp/mediaextractor.policy: -------------------------------------------------------------------------------- 1 | # MediaTek used system call 2 | gettimeofday: 1 3 | # for audio TableOfContent thread 4 | ioprio_set: 1 5 | unlinkat: 1 6 | setsockopt: 1 7 | clock_gettime: 1 8 | -------------------------------------------------------------------------------- /sepolicy/file_contexts: -------------------------------------------------------------------------------- 1 | # 2 | 3 | # For Google Trusty Secure Storage Proxy 4 | /data/trusty(/.*)? u:object_r:tee_data_file:s0 5 | 6 | /vendor/bin/storageproxyd u:object_r:tee_exec:s0 7 | /vendor/bin/pservice u:object_r:pservice_exec:s0 8 | /system/bin/startup.sh u:object_r:startup_exec:s0 9 | -------------------------------------------------------------------------------- /sepolicy/pservice.te: -------------------------------------------------------------------------------- 1 | type pservice, domain; 2 | type pservice_exec, exec_type, vendor_file_type, file_type; 3 | 4 | permissive pservice; 5 | init_daemon_domain(pservice) 6 | #allow pservice PServerBinder_service:service_manager {add find}; 7 | allow servicemanager pservice:dir search; 8 | allow servicemanager pservice:file { read open }; 9 | allow servicemanager pservice:process getattr; 10 | 11 | allow system_app pservice:binder call; 12 | -------------------------------------------------------------------------------- /sepolicy/service.te: -------------------------------------------------------------------------------- 1 | 2 | # Services 3 | type nvram_agent_service, service_manager_type; 4 | type PServerBinder_service, service_manager_type; 5 | -------------------------------------------------------------------------------- /sepolicy/service_contexts: -------------------------------------------------------------------------------- 1 | # Other Services 2 | NvRAMAgent u:object_r:nvram_agent_service:s0 3 | memory_dumper u:object_r:mediaserver_service:s0 4 | PServerBinder u:object_r:PServerBinder_service:s0 5 | -------------------------------------------------------------------------------- /sepolicy/startup.te: -------------------------------------------------------------------------------- 1 | type startup, domain; 2 | typeattribute startup coredomain; 3 | type startup_exec, exec_type, vendor_file_type, file_type; 4 | 5 | permissive startup; 6 | init_daemon_domain(startup) 7 | -------------------------------------------------------------------------------- /sepolicy/untrusted_app.te: -------------------------------------------------------------------------------- 1 | 2 | allow untrusted_app PServerBinder_service:service_manager find; 3 | allow untrusted_app mnt_media_rw_file:dir getattr; 4 | -------------------------------------------------------------------------------- /setup-makefiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (C) 2018 The LineageOS Project 3 | 4 | set -e 5 | 6 | DEVICE=pocket2 7 | VENDOR=retroid 8 | 9 | # Load extractutils and do some sanity checks 10 | MY_DIR="${BASH_SOURCE%/*}" 11 | if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi 12 | 13 | LINEAGE_ROOT="$MY_DIR"/../../.. 14 | 15 | HELPER="$LINEAGE_ROOT"/vendor/lineage/build/tools/extract_utils.sh 16 | if [ ! -f "$HELPER" ]; then 17 | echo "Unable to find helper script at $HELPER" 18 | exit 1 19 | fi 20 | . "$HELPER" 21 | 22 | # Initialize the helper 23 | setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" 24 | 25 | # Copyright headers and guards 26 | write_headers "$DEVICE" 27 | 28 | # The standard blobs 29 | write_makefiles "$MY_DIR"/proprietary-files.txt true 30 | 31 | # VNDK compat layer 32 | #write_makefiles "$MY_DIR"/proprietary-files-vndk.txt true 33 | 34 | # vendor blobs 35 | write_makefiles "$MY_DIR"/proprietary-files-vendor.txt true 36 | 37 | # We are done! 38 | write_footers 39 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | rild.libpath=mtk-ril.so 2 | rild.libargs=-d /dev/ttyC0 3 | 4 | 5 | # MTK, Infinity, 20090720 { 6 | wifi.interface=wlan0 7 | # MTK, Infinity, 20090720 } 8 | 9 | # MTK, mtk03034, 20101210 { 10 | ro.mediatek.wlan.wsc=1 11 | # MTK, mtk03034 20101210} 12 | # MTK, mtk03034, 20110318 { 13 | ro.mediatek.wlan.p2p=1 14 | # MTK, mtk03034 20110318} 15 | 16 | # MTK, mtk03034, 20101213 { 17 | mediatek.wlan.ctia=0 18 | # MTK, mtk03034 20101213} 19 | 20 | 21 | # 22 | wifi.tethering.interface=ap0 23 | # 24 | 25 | wifi.direct.interface=p2p0 26 | #dalvik.vm.heapgrowthlimit=128m 27 | #dalvik.vm.heapsize=256m 28 | 29 | # USB MTP WHQL 30 | ro.sys.usb.mtp.whql.enable=0 31 | 32 | # Power off opt in IPO 33 | sys.ipo.pwrdncap=2 34 | 35 | ro.sys.usb.storage.type=mtp 36 | 37 | # USB BICR function 38 | ro.sys.usb.bicr=no 39 | 40 | # USB Charge only function 41 | ro.sys.usb.charging.only=yes 42 | 43 | # audio 44 | ro.camera.sound.forced=0 45 | ro.audio.silent=0 46 | 47 | ro.zygote.preload.enable=0 48 | 49 | # temporary enables NAV bar (soft keys) 50 | qemu.hw.mainkeys=1 51 | 52 | ro.kernel.zio=38,108,105,16 53 | #ro.kernel.qemu=0 54 | #ro.kernel.qemu.gles=0 55 | ro.opengles.version=131072 56 | #ro.boot.selinux=disable 57 | 58 | # Disable dirty region for Mali 59 | debug.hwui.render_dirty_regions=false 60 | debug.hwui.use_partial_updates=false 61 | 62 | debug.sf.latch_unsignaled=1 63 | persist.sys.display.clearMotion=1 64 | 65 | persist.sys.strictmode.visual=0 66 | persist.sys.strictmode.disable=1 67 | 68 | config.disable_cameraservice=true 69 | 70 | -------------------------------------------------------------------------------- /vendor.prop: -------------------------------------------------------------------------------- 1 | ro.mediatek.chip_ver=S01 2 | ro.mediatek.platform=MT6580 3 | media.settings.xml=/vendor/etc/media_profiles.xml 4 | ro.media.maxmem=262144000 5 | ril.specific.sm_cause=0 6 | ril.external.md=0 7 | ro.sf.hwrotation=0 8 | ro.opengles.version=131072 9 | persist.radio.fd.counter=150 10 | persist.radio.fd.off.counter=50 11 | persist.radio.fd.r8.counter=150 12 | persist.radio.fd.off.r8.counter=50 13 | drm.service.enabled=true 14 | fmradio.driver.enable=0 15 | ril.first.md=1 16 | ril.flightmode.poweroffMD=1 17 | ril.telephony.mode=0 18 | dalvik.vm.mtk-stack-trace-file=/data/anr/mtk_traces.txt 19 | mediatek.wlan.chip=CONSYS_MT6735 20 | mediatek.wlan.module.postfix=_consys_mt6735 21 | ril.radiooff.poweroffMD=0 22 | ro.frp.pst=/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/frp 23 | ro.audio.usb.period_us=16000 24 | ro.mtk_config_max_dram_size=0x40000000 25 | ro.mtk_gmo_ram_optimize=1 26 | ro.config.low_ram=true 27 | ro.lmk.critical_upgrade=true 28 | ro.lmk.upgrade_pressure=40 29 | pm.dexopt.downgrade_after_inactive_days=10 30 | pm.dexopt.shared=quicken 31 | dalvik.vm.heapgrowthlimit=128m 32 | dalvik.vm.heapsize=256m 33 | dalvik.vm.foreground-heap-growth-multiplier=2.0 34 | ro.mtk_protocol1_rat_config=W/G 35 | ro.mtk_audio_alac_support=1 36 | ro.mediatek.version.branch=alps-trunk-o1.bsp 37 | ro.mediatek.version.release=alps-mp-o1.mp2 38 | ro.mediatek.version.sdk=4 39 | bt.profiles.avrcp.multiPlayer.enable=0 40 | ro.num_md_protocol=2 41 | ro.mtk_besloudness_support=1 42 | ro.mtk_bt_support=1 43 | ro.mtk_wappush_support=1 44 | ro.mtk_audio_tuning_tool_ver=V1 45 | ro.mtk_wlan_support=1 46 | ro.mtk_omacp_support=1 47 | ro.mtk_search_db_support=1 48 | ro.mtk_dhcpv6c_wifi=1 49 | ro.have_aacencode_feature=1 50 | ro.mtk_fd_support=1 51 | ro.mtk_widevine_drm_l3_support=1 52 | ro.mtk_audio_ape_support=1 53 | ro.mtk_flv_playback_support=1 54 | ro.mtk_wmv_playback_support=1 55 | ro.mtk_send_rr_support=1 56 | ro.mtk_emmc_support=1 57 | ro.mtk_bsp_package=1 58 | ro.telephony.default_network=0,0 59 | ro.mtk_ril_mode=c6m_3rild 60 | ro.mtk_shared_sdcard=1 61 | ro.mtk_flight_mode_power_off_md=1 62 | ro.mtk_pq_support=2 63 | ro.mtk_pq_color_mode=1 64 | ro.mtk_bip_scws=1 65 | ro.mtk_gmo_rom_optimize=1 66 | ro.mtk_world_phone_policy=0 67 | ro.mtk_mobile_management=1 68 | ro.mtk_cam_mfb_support=0 69 | ro.mtk_cam_cfb=1 70 | ro.mtk_bg_power_saving_support=1 71 | ro.mtk_bg_power_saving_ui=1 72 | ro.ap_info_monitor=0 73 | ro.mtk_dual_mic_support=0 74 | ro.mtk_is_tablet=0 75 | persist.service.acm.enable=0 76 | persist.mtk_vilte_support=0 77 | ro.mtk_ims_video_call_support=none 78 | persist.mtk_viwifi_support=0 79 | ro.mtk_vilte_ut_support=0 80 | wfd.dummy.enable=1 81 | wfd.iframesize.level=0 82 | persist.mtk.wcn.coredump.mode=2 83 | persist.mtk.wcn.combo.chipid=-1 84 | persist.mtk.wcn.patch.version=-1 85 | persist.mtk.wcn.dynamic.dump=0 86 | service.wcn.driver.ready=no 87 | persist.mtk.connsys.poweron.ctl=0 88 | ro.com.android.mobiledata=false 89 | persist.radio.mobile.data=0,0 90 | persist.meta.dumpdata=0 91 | persist.radio.mtk_ps2_rat=G 92 | persist.radio.mtk_ps3_rat=G 93 | persist.log.tag.RILMUXD=I 94 | persist.log.tag.tel_log_ctrl=1 95 | persist.log.tag.AT=I 96 | persist.log.tag.RILC-MTK=I 97 | persist.log.tag.RILC=I 98 | persist.log.tag.RfxMainThread=I 99 | persist.log.tag.RfxRoot=I 100 | persist.log.tag.RfxRilAdapter=I 101 | persist.log.tag.RfxController=I 102 | persist.log.tag.RILC-RP=I 103 | persist.log.tag.RfxTransUtils=I 104 | persist.log.tag.DCT=I 105 | persist.log.tag.MtkDCT=I 106 | persist.log.tag.RIL-DATA=I 107 | persist.log.tag.C2K_RIL-DATA=I 108 | persist.log.tag.GsmCdmaPhone=I 109 | persist.log.tag.SSDecisonMaker=I 110 | persist.log.tag.GsmMmiCode=I 111 | persist.log.tag.RpSsController=I 112 | persist.log.tag.RIL-SS=I 113 | persist.log.tag.RILMD2-SS=I 114 | persist.log.tag.CapaSwitch=I 115 | persist.log.tag.DSSelector=I 116 | persist.log.tag.DSSelectorOm=I 117 | persist.log.tag.DSSelectorOP01=I 118 | persist.log.tag.DSSelectorOP02=I 119 | persist.log.tag.DSSelectorOP09=I 120 | persist.log.tag.DSSelectorOP18=I 121 | persist.log.tag.DSSelectorUtil=I 122 | persist.log.tag.DcFcMgr=I 123 | persist.log.tag.DC-1=I 124 | persist.log.tag.DC-2=I 125 | persist.log.tag.RetryManager=I 126 | persist.log.tag.IccProvider=I 127 | persist.log.tag.IccPhoneBookIM=I 128 | persist.log.tag.AdnRecordCache=I 129 | persist.log.tag.AdnRecordLoader=I 130 | persist.log.tag.AdnRecord=I 131 | persist.log.tag.RIL-PHB=I 132 | persist.log.tag.MtkIccProvider=I 133 | persist.log.tag.MtkIccPHBIM=I 134 | persist.log.tag.MtkAdnRecord=I 135 | persist.log.tag.MtkRecordLoader=I 136 | persist.log.tag.RpPhbController=I 137 | persist.log.tag.RmcPhbReq=I 138 | persist.log.tag.RmcPhbUrc=I 139 | persist.log.tag.RtcPhb=I 140 | persist.log.tag.RIL-SMS=I 141 | persist.log.tag.DupSmsFilterExt=I 142 | persist.log.tag.ConSmsFwkExt=I 143 | persist.log.tag.DataOnlySmsFwk=I 144 | persist.log.tag.VT=I 145 | persist.log.tag.ImsVTProvider=I 146 | persist.log.tag.IccCardProxy=I 147 | persist.log.tag.SpnOverride=I 148 | persist.log.tag.UiccCard=I 149 | persist.log.tag.UiccController=I 150 | persist.log.tag.CountryDetector=I 151 | persist.log.tag.NetworkStats=I 152 | persist.log.tag.NetworkPolicy=I 153 | persist.log.tag.DataDispatcher=I 154 | persist.log.tag.ImsService=I 155 | persist.log.tag.IMS_RILA=I 156 | persist.log.tag.IMSRILRequest=I 157 | persist.log.tag.ImsManager=I 158 | persist.log.tag.ImsApp=I 159 | persist.log.tag.ImsBaseCommands=I 160 | persist.log.tag.MtkImsManager=I 161 | persist.log.tag.MtkImsService=I 162 | persist.log.tag.ImsCall=I 163 | persist.log.tag.ImsPhone=I 164 | persist.log.tag.ImsPhoneCall=I 165 | persist.log.tag.ImsPhoneBase=I 166 | persist.log.tag.ImsCallSession=I 167 | persist.log.tag.ImsCallProfile=I 168 | persist.log.tag.ImsEcbm=I 169 | persist.log.tag.ImsEcbmProxy=I 170 | persist.log.tag.OperatorUtils=I 171 | persist.log.tag.WfoApp=I 172 | persist.log.tag.GbaApp=I 173 | persist.log.tag.GbaBsfProcedure=I 174 | persist.log.tag.GbaBsfResponse=I 175 | persist.log.tag.GbaDebugParam=I 176 | persist.log.tag.GbaService=I 177 | persist.log.tag.SresResponse=I 178 | persist.log.tag.ImsUtService=I 179 | persist.log.tag.ImsUt=I 180 | persist.log.tag.SuppSrvConfig=I 181 | persist.log.tag.ECCCallHelper=I 182 | persist.log.tag.GsmConnection=I 183 | persist.log.tag.TelephonyConf=I 184 | persist.log.tag.TeleConfCtrler=I 185 | persist.log.tag.TelephonyConn=I 186 | persist.log.tag.TeleConnService=I 187 | persist.log.tag.ECCRetryHandler=I 188 | persist.log.tag.ECCNumUtils=I 189 | persist.log.tag.ECCRuleHandler=I 190 | persist.log.tag.SuppMsgMgr=I 191 | persist.log.tag.ECCSwitchPhone=I 192 | persist.log.tag.GsmCdmaConn=I 193 | persist.log.tag.Phone=I 194 | persist.log.tag.RIL-CC=I 195 | persist.log.tag.RpCallControl=I 196 | persist.log.tag.RpAudioControl=I 197 | persist.log.tag.GsmCallTkrHlpr=I 198 | persist.log.tag.MtkPhoneNotifr=I 199 | persist.log.tag.MtkFactory=I 200 | persist.log.tag.MtkGsmCdmaConn=I 201 | persist.log.tag.RadioManager=I 202 | persist.log.tag.RIL_Mux=I 203 | persist.log.tag.RIL-OEM=I 204 | persist.log.tag.RIL=I 205 | persist.log.tag.RIL_UIM_SOCKET=I 206 | persist.log.tag.RILD=I 207 | persist.log.tag.RIL-RP=I 208 | persist.log.tag.RfxMessage=I 209 | persist.log.tag.RfxDebugInfo=I 210 | persist.log.tag.RfxTimer=I 211 | persist.log.tag.RfxObject=I 212 | persist.log.tag.SlotQueueEntry=I 213 | persist,log.tag.SuppServHelper=I 214 | persist.log.tag.RfxAction=I 215 | persist.log.tag.RFX=I 216 | persist.log.tag.RpRadioMessage=I 217 | persist.log.tag.RpModemMessage=I 218 | persist.log.tag.PhoneFactory=I 219 | persist.log.tag.ProxyController=I 220 | persist.log.tag.SmsPlusCode=I 221 | persist.log.tag.AutoRegSmsFwk=I 222 | persist.log.tag.AirplaneHandler=I 223 | persist.log.tag.RfxDefDestUtils=I 224 | persist.log.tag.RfxSM=I 225 | persist.log.tag.RfxSocketSM=I 226 | persist.log.tag.RfxDT=I 227 | persist.log.tag.RpCdmaOemCtrl=I 228 | persist.log.tag.RpRadioCtrl=I 229 | persist.log.tag.RpMDCtrl=I 230 | persist.log.tag.RpCdmaRadioCtrl=I 231 | persist.log.tag.RpFOUtils=I 232 | persist.log.tag.MGsmSMSDisp=I 233 | persist.log.tag.MSmsStorageMtr=I 234 | persist.log.tag.MSmsUsageMtr=I 235 | persist.log.tag.Mtk_RIL_ImsSms=I 236 | persist.log.tag.MtkConSmsFwk=I 237 | persist.log.tag.MtkDupSmsFilter=I 238 | persist.log.tag.MtkIccSmsIntMgr=I 239 | persist.log.tag.MtkRuimFH=I 240 | persist.log.tag.MtkSmsCbHeader=I 241 | persist.log.tag.MtkSmsManager=I 242 | persist.log.tag.MtkSmsMessage=I 243 | persist.log.tag.MtkSpnOverride=I 244 | persist.log.tag.MtkIccCardProxy=I 245 | persist.log.tag.MtkUiccCard=I 246 | persist.log.tag.MtkUiccCardApp=I 247 | persist.log.tag.MtkUiccCtrl=I 248 | persist.log.tag.RpRilClientCtrl=I 249 | persist.log.tag.RilMalClient=I 250 | persist.log.tag.MtkSubCtrl=I 251 | persist.log.tag.RP_DAC=I 252 | mtk.vdec.waitkeyframeforplay=1 253 | ro.sys.sdcardfs=1 254 | debug.sf.disable_backpressure=1 255 | ro.ksc5601_write=0 256 | ro.email_support_ucs2=0 257 | ro.ussd_ksc5601=0 258 | persist.log.tag.CdmaMoSms=I 259 | persist.log.tag.CdmaMtSms=I 260 | ro.mtk_log_hide_gps=1 261 | ro.have_aee_feature=1 262 | ro.mtk_exchange_support=1 263 | RO_VENDOR_VNDK_VERSION 264 | RO_PRODUCT_FIRST_API_LEVEL 265 | ro.control_privapp_permissions=log 266 | ro.mtk_f2fs_enable=0 267 | ro.mtk_hidl_consolidation=1 268 | ro.com.google.clientidbase.gmm=android-mtk 269 | Build.BRAND=MTK 270 | ro.boot.opt_using_default=1 271 | ro.boot.opt_md1_support=3 272 | ro.boot.opt_c2k_lte_mode=0 273 | ro.boot.opt_ps1_rat=W/G 274 | dalvik.vm.jit.codecachesize=0 275 | persist.sampling_profiler=1 276 | -------------------------------------------------------------------------------- /vendorsetup.sh: -------------------------------------------------------------------------------- 1 | # Add pocket2 to lunch menu 2 | 3 | # AOSP 4 | # User builds 5 | add_lunch_combo aosp_pocket2-user 6 | # With debug stuff 7 | add_lunch_combo aosp_pocket2-userdebug 8 | 9 | # Eng builds 10 | add_lunch_combo aosp_pocket2-eng 11 | 12 | # LineageOS 13 | # User builds 14 | add_lunch_combo lineage_pocket2-user 15 | # With debug stuff 16 | add_lunch_combo lineage_pocket2-userdebug 17 | 18 | # Eng builds 19 | add_lunch_combo lineage_pocket2-eng 20 | 21 | # LineageOS ATV builds 22 | # User builds 23 | add_lunch_combo lineage_atv_pocket2-user 24 | # With debug stuff 25 | add_lunch_combo lineage_atv_pocket2-userdebug 26 | 27 | # Eng builds 28 | add_lunch_combo lineage_atv_pocket2-eng 29 | 30 | # Grab repola 31 | echo "Deleting old versions of repola" 32 | echo " " 33 | workingDir=$(pwd) 34 | rm $workingDir/device/retroid/pocket2/prebuilt/RePoLa/*.apk 35 | echo "Removed old version" 36 | echo "" 37 | echo "Downloading latest" 38 | cd device/retroid/pocket2/prebuilt/RePoLa/ && wget https://github.com/sreichholf/repola/releases/latest/download/launcher-release.apk && echo " " && echo "Success!" && cd ../../../../../ 39 | -------------------------------------------------------------------------------- /vndk/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(LOCAL_PATH)/vndk-sp-libs.mk 4 | 5 | define define-vndk-sp-lib 6 | include $$(CLEAR_VARS) 7 | LOCAL_MODULE := $1.vndk-sp-gen 8 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 9 | LOCAL_PREBUILT_MODULE_FILE := $$(TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so 10 | LOCAL_STRIP_MODULE := false 11 | LOCAL_MULTILIB := first 12 | LOCAL_MODULE_TAGS := optional 13 | LOCAL_INSTALLED_MODULE_STEM := $1.so 14 | LOCAL_MODULE_SUFFIX := .so 15 | LOCAL_MODULE_RELATIVE_PATH := vndk-sp 16 | include $$(BUILD_PREBUILT) 17 | 18 | ifneq ($$(TARGET_2ND_ARCH),) 19 | ifneq ($$(TARGET_TRANSLATE_2ND_ARCH),true) 20 | include $$(CLEAR_VARS) 21 | LOCAL_MODULE := $1.vndk-sp-gen 22 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES 23 | LOCAL_PREBUILT_MODULE_FILE := $$($$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so 24 | LOCAL_STRIP_MODULE := false 25 | LOCAL_MULTILIB := 32 26 | LOCAL_MODULE_TAGS := optional 27 | LOCAL_INSTALLED_MODULE_STEM := $1.so 28 | LOCAL_MODULE_SUFFIX := .so 29 | LOCAL_MODULE_RELATIVE_PATH := vndk-sp 30 | include $$(BUILD_PREBUILT) 31 | endif # TARGET_TRANSLATE_2ND_ARCH is not true 32 | endif # TARGET_2ND_ARCH is not empty 33 | endef 34 | 35 | $(foreach lib,$(VNDK_SP_LIBRARIES),\ 36 | $(eval $(call define-vndk-sp-lib,$(lib)))) 37 | 38 | include $(CLEAR_VARS) 39 | LOCAL_MODULE := vndk-sp 40 | LOCAL_MODULE_TAGS := optional 41 | LOCAL_REQUIRED_MODULES := $(addsuffix .vndk-sp-gen,$(VNDK_SP_LIBRARIES)) 42 | include $(BUILD_PHONY_PACKAGE) 43 | -------------------------------------------------------------------------------- /vndk/vndk-sp-libs.mk: -------------------------------------------------------------------------------- 1 | VNDK_SP_LIBRARIES := \ 2 | android.hardware.graphics.allocator@2.0 \ 3 | android.hardware.graphics.common@1.0 \ 4 | android.hardware.graphics.mapper@2.0 \ 5 | android.hardware.renderscript@1.0 \ 6 | android.hidl.memory@1.0 \ 7 | libbacktrace \ 8 | libbase \ 9 | libbcinfo \ 10 | libblas \ 11 | libc++ \ 12 | libcompiler_rt \ 13 | libcutils \ 14 | libft2 \ 15 | libhardware \ 16 | libhidlbase \ 17 | libhidlmemory \ 18 | libhidltransport \ 19 | libhwbinder \ 20 | libion \ 21 | liblzma \ 22 | libpng \ 23 | libRSCpuRef \ 24 | libRSDriver \ 25 | libRS_internal \ 26 | libunwind \ 27 | libutils 28 | --------------------------------------------------------------------------------