Skip to content

Commit d7a8d0d

Browse files
authored
Add files via upload
1 parent 466a616 commit d7a8d0d

8 files changed

Lines changed: 303 additions & 2 deletions

File tree

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#!/sbin/sh
2+
##########################################################################################
3+
#
4+
# Magisk Module Template Install Script
5+
# by topjohnwu
6+
#
7+
##########################################################################################
8+
9+
# Detect whether in boot mode
10+
ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false
11+
$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true
12+
13+
TMPDIR=/dev/tmp
14+
INSTALLER=$TMPDIR/install
15+
MAGISKBIN=/data/adb/magisk
16+
17+
# Default permissions
18+
umask 022
19+
20+
# Initial cleanup
21+
rm -rf $TMPDIR 2>/dev/null
22+
mkdir -p $INSTALLER
23+
24+
# echo before loading util_functions
25+
ui_print() { echo "$1"; }
26+
27+
require_new_magisk() {
28+
ui_print "*******************************"
29+
ui_print " Please install Magisk v15.0+! "
30+
ui_print "*******************************"
31+
exit 1
32+
}
33+
34+
##########################################################################################
35+
# Environment
36+
##########################################################################################
37+
38+
OUTFD=$2
39+
ZIP=$3
40+
41+
mount /data 2>/dev/null
42+
43+
# Utility functions must exist
44+
[ -f $MAGISKBIN/util_functions.sh ] || require_new_magisk
45+
# Load utility fuctions
46+
. $MAGISKBIN/util_functions.sh
47+
48+
# We can't alter magisk image live, use alternative image if required
49+
$BOOTMODE && IMG=/data/adb/magisk_merge.img
50+
# Always mount under tmp
51+
MOUNTPATH=$TMPDIR/magisk_img
52+
53+
# Preperation for flashable zips
54+
get_outfd
55+
56+
# Mount partitions
57+
mount_partitions
58+
59+
# Detect version and architecture
60+
api_level_arch_detect
61+
62+
# You can get the Android API version from $API, the CPU architecture from $ARCH
63+
# Useful if you are creating Android version / platform dependent mods
64+
65+
# Setup busybox and binaries
66+
$BOOTMODE && boot_actions || recovery_actions
67+
68+
##########################################################################################
69+
# Preparation
70+
##########################################################################################
71+
72+
# Extract common files
73+
unzip -o "$ZIP" module.prop config.sh 'common/*' -d $INSTALLER >&2
74+
75+
[ ! -f $INSTALLER/config.sh ] && abort "! Unable to extract zip file!"
76+
# Load configurations
77+
. $INSTALLER/config.sh
78+
79+
# Check the installed magisk version
80+
MIN_VER=`grep_prop minMagisk $INSTALLER/module.prop`
81+
[ ! -z $MAGISK_VER_CODE -a $MAGISK_VER_CODE -ge $MIN_VER ] || require_new_magisk
82+
MODID=`grep_prop id $INSTALLER/module.prop`
83+
MODPATH=$MOUNTPATH/$MODID
84+
85+
# Print mod name
86+
print_modname
87+
88+
# Please leave this message in your flashable zip for credits :)
89+
ui_print "******************************"
90+
ui_print "Powered by Magisk (@topjohnwu)"
91+
ui_print "******************************"
92+
93+
##########################################################################################
94+
# Install
95+
##########################################################################################
96+
97+
# Get the variable reqSizeM. Use your own method to determine reqSizeM if needed
98+
request_zip_size_check "$ZIP"
99+
100+
# This function will mount $IMG to $MOUNTPATH, and resize the image based on $reqSizeM
101+
mount_magisk_img
102+
103+
# Create mod paths
104+
rm -rf $MODPATH 2>/dev/null
105+
mkdir -p $MODPATH
106+
107+
# Extract files to system. Use your own method if needed
108+
ui_print "- Extracting module files"
109+
unzip -o "$ZIP" 'system/*' -d $MODPATH >&2
110+
111+
mkdir -p $MODPATH/system/vendor/etc
112+
cp -f /system/vendor/etc/mixer_paths_tavil.xml $MODPATH/system/vendor/etc/mixer_paths_tavil.xml
113+
cp -f $INSTALLER/common/.aml.sh $MODPATH/.aml.sh
114+
. $INSTALLER/common/.aml.sh
115+
116+
# Remove placeholder
117+
rm -f $MODPATH/system/placeholder 2>/dev/null
118+
119+
# Handle replace folders
120+
for TARGET in $REPLACE; do
121+
mktouch $MODPATH$TARGET/.replace
122+
done
123+
124+
# Auto Mount
125+
$AUTOMOUNT && touch $MODPATH/auto_mount
126+
127+
# prop files
128+
$PROPFILE && cp -af $INSTALLER/common/system.prop $MODPATH/system.prop
129+
130+
# Module info
131+
cp -af $INSTALLER/module.prop $MODPATH/module.prop
132+
if $BOOTMODE; then
133+
# Update info for Magisk Manager
134+
mktouch /sbin/.core/img/$MODID/update
135+
cp -af $INSTALLER/module.prop /sbin/.core/img/$MODID/module.prop
136+
fi
137+
138+
# post-fs-data mode scripts
139+
$POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
140+
141+
# service mode scripts
142+
$LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
143+
144+
ui_print "- Setting permissions"
145+
set_permissions
146+
147+
##########################################################################################
148+
# Finalizing
149+
##########################################################################################
150+
151+
# Unmount magisk image and shrink if possible
152+
unmount_magisk_img
153+
154+
$BOOTMODE || recovery_cleanup
155+
rm -rf $TMPDIR
156+
157+
ui_print "- Done"
158+
exit 0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#MAGISK

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
# op6stereo
2-
OnePlus 6 Stereo Speaker Mod
1+
Changelog:
2+
3+
v1 - Initial Release
4+
v2 - Fixed the earpiece not working throughout the system
5+
v3 - Fixed Earpiece not switching from multimedia to calls
6+
v4 - Fixed bluetooth audio issue
7+
v5 - Fixed right channel not playing through main speaker
8+
v6 - Fixed latency issue between earpiece and main speaker
9+
v7 - Added AML support, switched to patching of existing mixer, misc fixes

common/post-fs-data.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/system/bin/sh
2+
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
3+
# This will make your scripts compatible even if Magisk change its mount point in the future
4+
MODDIR=${0%/*}
5+
6+
# This script will be executed in post-fs-data mode
7+
# More info in the main Magisk thread

common/service.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/system/bin/sh
2+
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
3+
# This will make your scripts compatible even if Magisk change its mount point in the future
4+
MODDIR=${0%/*}
5+
6+
# This script will be executed in late_start service mode
7+
# More info in the main Magisk thread

common/system.prop

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file will be read by resetprop
2+
# Example: Change dpi
3+
# ro.sf.lcd_density=320

config.sh

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
##########################################################################################
2+
#
3+
# Magisk Module Template Config Script
4+
# by topjohnwu
5+
#
6+
##########################################################################################
7+
##########################################################################################
8+
#
9+
# Instructions:
10+
#
11+
# 1. Place your files into system folder (delete the placeholder file)
12+
# 2. Fill in your module's info into module.prop
13+
# 3. Configure the settings in this file (config.sh)
14+
# 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh
15+
# 5. Add your additional or modified system properties into common/system.prop
16+
#
17+
##########################################################################################
18+
19+
##########################################################################################
20+
# Configs
21+
##########################################################################################
22+
23+
# Set to true if you need to enable Magic Mount
24+
# Most mods would like it to be enabled
25+
AUTOMOUNT=true
26+
27+
# Set to true if you need to load system.prop
28+
PROPFILE=false
29+
30+
# Set to true if you need post-fs-data script
31+
POSTFSDATA=false
32+
33+
# Set to true if you need late_start service script
34+
LATESTARTSERVICE=false
35+
36+
##########################################################################################
37+
# Installation Message
38+
##########################################################################################
39+
40+
# Set what you want to show when installing your mod
41+
42+
print_modname() {
43+
ui_print "OP6 Stereo Speaker Mod For Pie"
44+
}
45+
46+
##########################################################################################
47+
# Replace list
48+
##########################################################################################
49+
50+
# List all directories you want to directly replace in the system
51+
# Check the documentations for more info about how Magic Mount works, and why you need this
52+
53+
# This is an example
54+
REPLACE="
55+
/system/app/Youtube
56+
/system/priv-app/SystemUI
57+
/system/priv-app/Settings
58+
/system/framework
59+
"
60+
61+
# Construct your own list here, it will override the example above
62+
# !DO NOT! remove this if you don't need to replace anything, leave it empty as it is now
63+
REPLACE="
64+
"
65+
66+
##########################################################################################
67+
# Permissions
68+
##########################################################################################
69+
70+
set_permissions() {
71+
# Only some special files require specific permissions
72+
# The default permissions should be good enough for most cases
73+
74+
# Here are some examples for the set_perm functions:
75+
76+
# set_perm_recursive <dirname> <owner> <group> <dirpermission> <filepermission> <contexts> (default: u:object_r:system_file:s0)
77+
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
78+
79+
# set_perm <filename> <owner> <group> <permission> <contexts> (default: u:object_r:system_file:s0)
80+
# set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0
81+
# set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0
82+
# set_perm $MODPATH/system/lib/libart.so 0 0 0644
83+
84+
# The following is default permissions, DO NOT remove
85+
set_perm_recursive $MODPATH 0 0 0755 0644
86+
}
87+
88+
##########################################################################################
89+
# Custom Functions
90+
##########################################################################################
91+
92+
# This file (config.sh) will be sourced by the main flash script after util_functions.sh
93+
# If you need custom logic, please add them here as functions, and call these functions in
94+
# update-binary. Refrain from adding code directly into update-binary, as it will make it
95+
# difficult for you to migrate your modules to newer template versions.
96+
# Make update-binary as clean as possible, try to only do function calls in it.
97+
98+
device_check() {
99+
if [ "$(grep_prop ro.product.device)" == "$1" ] || [ "$(grep_prop ro.build.product)" == "$1" ]; then
100+
return 0
101+
else
102+
return 1
103+
fi
104+
}
105+
106+
if ! device_check "OnePlus6" && ! device_check "Enchilada" && ! device_check "enchilada" && device_check "OnePlus6T" && ! device_check "Fajita" && ! device_check "fajita"; then
107+
ui_print "This mod is only for Oneplus 6/6T! Aborting!"
108+
$BOOTMODE || recovery_cleanup
109+
rm -rf $TMPDIR
110+
exit 1
111+
fi

module.prop

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
id=op6stereo
2+
name=Oneplus 6 OOS Stereo Speaker Mod
3+
version=v7
4+
versionCode=7
5+
author=acervenky
6+
description=Earpiece acts as a secondary speaker for stereo effect
7+
minMagisk=1500

0 commit comments

Comments
 (0)