客製化-杜

android9.0滅屏收到短信喚醒亮屏

代碼路徑:
vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java

 //*/ZY.dkl , receive SMS wakeup screen
private PowerManager.WakeLock mNotificationWakeLock;
private void screenWakeUp(NotificationData.Entry entry) {
if(mNotificationWakeLock == null){
mNotificationWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP |
PowerManager.ON_AFTER_RELEASE, TAG);
mNotificationWakeLock.setReferenceCounted(false);
}
if (!mPowerManager.isScreenOn() && entry.key != null && entry.key.contains("com.google.android.apps.messaging")) {
mNotificationWakeLock.acquire(3000);
Log.d(TAG, "special app notification turn screen on");
}
}
//*/
……
protected void addNotificationViews(NotificationData.Entry entry) {
if (entry == null) {
return;
}
// Add the expanded view and icon.
mNotificationData.add(entry);
tagForeground(entry.notification);
//*/tyd.dkl , receive SMS wakeup screen
screenWakeUp(entry);
//*/
updateNotifications();
}
……
private void updateNotificationInternal(StatusBarNotification notification,
NotificationListenerService.RankingMap ranking) throws InflationException {
if (CHATTY) Log.d(TAG, "updateNotification(" + notification + ")");
……
updateHeadsUp(key, entry, shouldPeek, alertAgain);
//*/ZY.dkl , receive SMS wakeup screen
screenWakeUp(entry);
//*/
updateNotifications();

if (!notification.isClearable()) {
// The user may have performed a dismiss action on the notification, since it's // not clearable we should snap it back. mListContainer.snapViewIfNeeded(entry.row); } …… 複製代碼

自定義PTT鍵

驅動層定義

device/droi/項目名/mtk-kpd.kl , 讓驅動同事幫忙定義一下

按鍵喚醒系統
kernel-4.4/drivers/input/keyboard/mediatek/kpd.c

static int kpd_pdrv_suspend(struct platform_device *pdev, pm_message_t state)
{
kpd_suspend = true;
//*/ZY.dkl,20181101, enable wake up
if (call_status == 2) {
kpd_print("kpd_early_suspend wake up source enable!! (%d)\n", kpd_suspend);
} else {
kpd_wakeup_src_setting(1);    //聽說會使電流增大0.2ma,能夠忽略
kpd_print("kpd_early_suspend wake up source disable!! (%d)\n", kpd_suspend);
}
/*/
#ifdef MTK_KP_WAKESOURCE //此宏表示僅打電話狀態下通常按鍵能夠喚醒系統
if (call_status == 2) {
kpd_print("kpd_early_suspend wake up source enable!! (%d)\n", kpd_suspend);
} else {
kpd_wakeup_src_setting(0);
kpd_print("kpd_early_suspend wake up source disable!! (%d)\n", kpd_suspend);
}
#endif
//*/
kpd_print("suspend!! (%d)\n", kpd_suspend);
return 0;
}

framework/base/core/java/android/view/KeyEvent.java

public static final boolean isWakeKey(int keyCode) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_WAKEUP:
case KeyEvent.KEYCODE_PAIRING:
case KeyEvent.KEYCODE_STEM_1:
case KeyEvent.KEYCODE_STEM_2:
case KeyEvent.KEYCODE_STEM_3:
case KeyEvent.KEYCODE_F12:   //此處添加Keycode
return true;
}
return false;
}

按鍵事件傳遞
frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -889,6 +889,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
PowerManager.WakeLock mBroadcastWakeLock;
PowerManager.WakeLock mPowerKeyWakeLock;
boolean mHavePendingMediaKeyRepeatWithWakeLock;
+ 
+ //*/ tyd.dkl , for PTT.
+ PowerManager.WakeLock mF12KeyWakeLock;
+ //*/

//*/ freeme.zhiwei.zhang, 20180120. OneHand.
protected int mCurrentUserId;
@@ -2152,6 +2156,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mAccessibilityManager = (AccessibilityManager) context.getSystemService(
Context.ACCESSIBILITY_SERVICE);

+ //*/ tyd.dkl , for PTT.
+ mF12KeyWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,
+ "PhoneWindowManager.mF12KeyWakeLock");
+ //*/
// register for dock events
IntentFilter filter = new IntentFilter();
filter.addAction(UiModeManager.ACTION_ENTER_CAR_MODE);
@@ -3870,7 +3878,27 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
return -1;
}
-
+ //*/ tyd.dkl , for PTT.     interceptKeyBeforeDispatching
+ else if (keyCode == KeyEvent.KEYCODE_F12) {
+ if (down && repeatCount == 0) {
+ Intent intent = new Intent("com.android.ctyon.PTT.KEY_DOWN");
+ intent.addFlags(0x01000000);    //O上突破隱式廣播限制
+ mContext.sendBroadcast(intent);
+ if (!mF12KeyWakeLock.isHeld()) {
+ mF12KeyWakeLock.acquire();
+ }
+ Slog.i("dkl", "PTT.down");
+ } else if (event.getAction() == KeyEvent.ACTION_UP){
+ Intent intent = new Intent("com.android.ctyon.PTT.KEY_UP");
+ intent.addFlags(0x01000000);   //O上突破隱式廣播限制
+ mContext.sendBroadcast(intent);
+ Slog.i("dkl", "PTT.up");
+ if (mF12KeyWakeLock.isHeld()) {
+ mF12KeyWakeLock.release();
+ }
+ }
+ }
+ //*/
// Toggle Caps Lock on META-ALT.
boolean actionTriggered = false;
if (KeyEvent.isModifierKey(keyCode)) {
@@ -6476,6 +6504,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {

// Handle special keys.
switch (keyCode) {
+ //*/dkl     interceptKeyBeforeQueueing
+ case KeyEvent.KEYCODE_F12: {
+ result |= ACTION_PASS_TO_USER;
+ android.util.Log.d("dkl", "====KeyEvent.KEYCODE_F12");
+ break;
+ }
+ //*/
case KeyEvent.KEYCODE_BACK: {
if (down) {
interceptBackKeyDown();

複製代碼

MTK FMRadio 修改工做頻率範圍的方法

全球大部分國家的調頻廣播頻率範圍基本都是87.5-108.0 Mhz,但也有些例外,好比日本的爲76.0-90.0Mhz。java

mtk平臺默認都是87.5-108.0Mhz,若是該機型銷往日本,那麼咱們就須要修改FM頻率範圍。linux

MTK已經預留好宏和變量,改個值就好,代碼是基於O的,可是這一塊基本沒什麼變化,O以前以及以後應該也是適用的,可能文件路徑會有改變android

一、device/mediatek/common/kernel-headers/linux/fm.h 找到如下宏修改以下安全

#define FMR_BAND 3 //FM radio band, 1:87.5MHz~108.0MHz; 2:76.0MHz~90.0MHz; 3:76.0MHz~108.0MHz; 4:special
#define FMR_BAND_FREQ_L 760 //FM radio special band low freq(Default 87.5MHz)
#define FMR_BAND_FREQ_H 1080 //FM radio special band high freq(Default 108.0MHz)

#define FM_BAND_DEFAULT FM_BAND_JAPANW

#define FM_RAIDO_BAND FM_BAND_JAPANW
複製代碼

二、vendor/mediatek/proprietary/packages/apps/FMRadio/src/com/android/fmradio/FmUtils.javabash

修改以下幾個變量app

// maximum station frequency
private static final int HIGHEST_STATION = 1080;
// minimum station frequency
private static final int LOWEST_STATION = 760;
// maximum station frequency 50khz
private static final int HIGHEST_STATION_50KHZ = 10800;
// minimum station frequency 50khz
private static final int LOWEST_STATION_50KHZ = 7600;
複製代碼

第三方應用白名單

不少出貨國內要使用freeme os的客戶,好比天龍世紀、南極星,基本都要內置某個對講類的app。因爲 freeme os的對第三方應用的限制不少,內置這些應用時須要注意解除一些限制,保證此類app功能正常運行。ide

針對freeme 8.1 (android O1)總結以下:ui

一、默認賦予該應用申請的全部權限google

vendor/freeme/frameworks/base/data/etc/default-permissions-freeme.xml
具體寫法可參考該文件的內容,好比:  
<exception
package="com.ctchat.sample"
type=""
trust="true" >
</exception>
複製代碼

二、設置-應用-自啓動管理,默認打開開關後臺服務才能收到開機廣播或者其餘廣播spa

vendor/freeme/packages/providers/FreemeConfigProvider/RRO/res/values/arrays.xml,添加item便可默認打開
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="config_atlas_custom_white_list" translatable="false">
<item>com.ctchat.sample</item>
</string-array>
</resources>
複製代碼

三、點擊最近應用裏的清理會殺死不帶鎖的應用,須要默認上鎖

vendor/freeme/packages/providers/FreemeSettingsProvider/res/values/defaults.xml
<string name="def_sysui_recent_locked_tasks" translatable="false">com.ctchat.sample</string>
複製代碼

四、桌面一鍵清理、設置-安全中內心的懸浮窗管理和通知管理,這三項都須要找負責安全中心來客制,他會提供給你如下文件去override便可

vendor/freeme/packages/apps/security/Security/default_local_config

五、進程保活,低內存時不輕易被系統殺掉

vendor/freeme/frameworks/base/core/java/com/freeme/internal/util/FreemeCustomizedOom.java
private static final Map<String, Integer> DEFAULT_APP_ADJ_MAP = new HashMap<String, Integer>() {{
     put("com.ctchat.sample", HEAVY_WEIGHT_APP_ADJ);
}};
複製代碼

Sensor 失敗項

CTS 版本: 9.0_r8 CtsSensorTestCases

失敗項以下:

android.hardware.cts.SensorBatchingTests#testGameRotationVector_50hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_51hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_52hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_53hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_54hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_55hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_56hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_57hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_58hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_59hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_60hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_61hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_62hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_63hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_64hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_65hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_66hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_67hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_68hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_69hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_70hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_71hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_72hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_73hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_74hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_75hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_76hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_77hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_78hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_79hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_80hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_81hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_82hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_83hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_84hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_85hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_86hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_87hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_88hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_89hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_90hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_91hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_92hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_93hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_94hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_95hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_96hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_97hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_98hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_99hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_100hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_101hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_102hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_103hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_104hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_105hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_106hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_107hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_108hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_109hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_110hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_111hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_112hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_113hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_114hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_115hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_116hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_117hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_118hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_119hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_120hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_121hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_122hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_123hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_124hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_125hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_126hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_127hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_128hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_129hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_130hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_131hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_132hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_133hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_134hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_135hz_batching
android.hardware.cts.SensorBatchingTests#testGameRotationVector_136hz_batching
複製代碼

具體細節以下(都相似,僅列舉一項):

junit.framework.AssertionFailedError: VerifySensorOperation | sensor='GAME_ROTATION_VECTOR', samplingPeriod=20000us, maxReportLatency=10000000us | Frequency out of range: Requested "GAME_ROTATION_VECTOR" at 50.00hz (expecting between 45.00Hz and 110.00Hz, measured InfinityHz), 627 event timestamp synchronization failures: position=0, timestamp=0.00ms, expected=[14827541.13ms, 14839596.68]ms; position=1, timestamp=0.00ms, expected=[14827541.15ms, 14839596.71]ms; position=2, timestamp=0.00ms, expected=[14827541.16ms, 14839596.72]ms; more; , 626 events out of order: position=1, previous_ts=0.00ms, current_ts=0.00msposition=2, previous_ts=0.00ms, current_ts=0.00msposition=3, previous_ts=0.00ms, current_ts=0.00ms623 more, Didn't collect any measurements after 2000000000ns 複製代碼

修改方法:

去掉MAGNETOMETER相關sensor ProjectConfig.mk中

#sensor{
CUSTOM_KERNEL_DEVICE_ORIENTATION = no
CUSTOM_KERNEL_LINEARACCEL_SENSOR = no
CUSTOM_KERNEL_MAGNETOMETER = no
CUSTOM_KERNEL_GMRV_SENSOR = no
CUSTOM_KERNEL_GRAVITY_SENSOR = no
CUSTOM_KERNEL_GRV_SENSOR = no
CUSTOM_KERNEL_RV_SENSOR = no
CUSTOM_KERNEL_UNCALI_MAG_SENSOR = no
CUSTOM_KERNEL_ORIENTATION_SENSOR = no
#}
複製代碼

defconfig 和 debug_defconfig中

# CONFIG_CUSTOM_KERNEL_MAGNETOMETER is not set
# CONFIG_MTK_MAGHUB is not set
# CONFIG_CUSTOM_KERNEL_GRV_SENSOR is not set
# CONFIG_CUSTOM_KERNEL_GMRV_SENSOR is not set
# CONFIG_CUSTOM_KERNEL_RV_SENSOR is not set
# CONFIG_CUSTOM_KERNEL_LINEARACCEL_SENSOR is not set 
# CONFIG_CUSTOM_KERNEL_GRAVITY_SENSOR is not set 
# CONFIG_CUSTOM_KERNEL_UNCALI_MAG_SENSOR is not set 
# CONFIG_MTK_DEVICE_ORIENTATION_HUB is not set
複製代碼

vendor/mediatek/proprietary/tinysys/freertos/source/middleware/contexthub/MEMS_Driver/accGyro/accGyro.c

。。。。。。
if (mTask.nowState == CHIP_IDLE) {
mTask.mSensorPerUnit[ACC].configed = true;
if (!mTask.pendingFlushFifo)
flushFifo();
//*/modify code  由於用的是mxc4005x,走else
#ifdef CFG_ICM40605_SUPPORT
accRateCalculate(rate, 0);
#else
accRateCalculate(rate, 0);
#endif
//*/ end
} else {
。。。。。。
複製代碼
相關文章
相關標籤/搜索