summaryrefstree
path: root/system/bin/preinstall.sh
blob: be976747b5bc395c3325bd23fa2d98d35fa4c5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#! /system/bin/sh

echo "Jancar preinstall apks... "

fun_preinstall_apk() {
    #    echo "\$#="$#
    #    if [ 2 = $# ]; then
    if [ -z "$(pm list package "$1")" ]; then
        if [ -f /vendor/preinstall/"$2" ]; then
            echo "install $2"
            /system/bin/pm install /vendor/preinstall/"$2"
        fi
    fi
    #    fi
}

if [ -f "/jancar/config/preinstall.sh" ]; then
    . "/jancar/config/preinstall.sh"
    preinstall_continue=$(getprop jancar.preinstall.continue)
    if [ "$preinstall_continue" != "1" ]; then
        exit
    fi
fi

# *** start ***
# GoogleMaps
fun_preinstall_apk com.google.android.apps.maps Googlemap.apk

# tima carnet
fun_preinstall_apk com.tima.carnet.vt timacarnet.apk

# youtube
fun_preinstall_apk com.google.android.youtube youtube.apk

# BaiduInput
#fun_preinstall_apk com.baidu.input BaiduInput.apk
if [ -z "$(pm list package com.baidu.input)" ]; then
    if [ -f /vendor/preinstall/BaiduInput.apk ]; then
        BaiduIme=com.baidu.input/.ImeService
        echo "install BaiduInput.apk"
        /system/bin/pm install /vendor/preinstall/BaiduInput.apk
        enabled_input_methods=$(/system/bin/settings get secure enabled_input_methods)
        if ! echo "$enabled_input_methods" | grep -q $BaiduIme; then
            /system/bin/settings put secure enabled_input_methods "${enabled_input_methods}":$BaiduIme
        fi
        echo "set default_input_method"
        # 后台执行
        {
            sleep 2
            /system/bin/settings put secure default_input_method $BaiduIme
            sleep 3
            if [ "$BaiduIme" != "$(/system/bin/settings get secure default_input_method)" ]; then
                /system/bin/settings put secure default_input_method $BaiduIme
            fi
        } &
#        wait
    fi
fi

# market
fun_preinstall_apk com.dofun.market market.apk

# ximalaya
fun_preinstall_apk com.ximalaya.ting.android.car OnlineFM.apk

# QQMusic
fun_preinstall_apk com.tencent.qqmusiccar QQMusic.apk

#cn.kuwo.kwmusiccar
#fun_preinstall_apk cn.kuwo.kwmusiccar KuwoPlayer.apk

# xcdvr2
fun_preinstall_apk com.williexing.android.apps.xcdvr1 xcdvr2.apk

# taixin
fun_preinstall_apk com.google.android.apps.maps Googlemap.apk

# thrid-app
if [ -d "/data/thrid-app" ]; then
    for file in /data/thrid-app/*; do
        if test -f $file; then
            echo "$file"
            /system/bin/pm install "$file"
            rm -rf "$file"
        else
            echo "$file"
        fi
    done
fi

am broadcast -a action.jancar.installapp.complete
# *** end ***