代码路径:
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); } …… 复制代码
驱动层定义
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();
复制代码
全球大部分国家的调频广播频率范围基本都是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);
}};
复制代码
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 {
。。。。。。
复制代码