Android 11 去掉性能受到影响,要停用.请查看引导加载程序通知

Android 11 去掉性能受到影响,要停用.请查看引导加载程序通知


前言

在进行Frameworks开发过程中开机的时候会弹出一个系统通知,内容是"性能受到影响。要停用,请查看引导加载程序。",所以需要找到通知位置将其去掉。
如下图所示
在这里插入图片描述

一、问题解决

1.定位问题

通过在framework搜索"性能受到影响。要停用,请查看引导加载程序。"字段找到定位位置,
请添加图片描述
再通过查询console_running_notification_message 找到使用字段的位置
在这里插入图片描述
最终定位到解决问题的位置

/frameworks/base/core/res/res/values-zh-rCN/strings.xml
/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java

2.解决问题

通过查看ActivityManagerService.java的代码发现在showConsoleNotificationIfActive(),发起了这个系统通知.

    private void showConsoleNotificationIfActive() {
        if (!SystemProperties.get("init.svc.console").equals("running")) {
            return;
        }
        String title = mContext
                .getString(com.android.internal.R.string.console_running_notification_title);
        String message = mContext
                .getString(com.android.internal.R.string.console_running_notification_message);
        Notification notification =
                new Notification.Builder(mContext, SystemNotificationChannels.DEVELOPER)
                        .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb)
                        .setWhen(0)
                        .setOngoing(true)
                        .setTicker(title)
                        .setDefaults(0)  // please be quiet
                        .setColor(mContext.getColor(
                                com.android.internal.R.color
                                        .system_notification_accent_color))
                        .setContentTitle(title)
                        .setContentText(message)
                        .setVisibility(Notification.VISIBILITY_PUBLIC)
                        .build();

        NotificationManager notificationManager =
                mContext.getSystemService(NotificationManager.class);
        notificationManager.notifyAsUser(
                null, SystemMessage.NOTE_SERIAL_CONSOLE_ENABLED, notification, UserHandle.ALL);

    }

解决问题,在调用showConsoleNotificationIfActive()方法的地方屏蔽掉然后就可以解决这个问题。

--- a/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5568,7 +5568,8 @@ public class ActivityManagerService extends IActivityManager.Stub
             mUserController.scheduleStartProfiles();
         }
         // UART is on if init's console service is running, send a warning notification.
-        showConsoleNotificationIfActive();
+        // showConsoleNotificationIfActive();  delete by ltj  去掉性能收到影响弹窗
+
 

总结

通过查询弹出框字段,通过grep 命令 找到字段id然后定位到弹出框位置,粗暴解决

参考

https://blog.csdn.net/baidu_41666295/article/details/124562947

每日赠言

无人问津也好,技不如人也罢,你都要试着让自己安静下来,做自己该做的事情,而不是让内心的烦躁不安,毁掉你本就不多的热情和定力。

  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
好的,下面是一个从数据加载到去除停用词和提取文本特征向量的示例代码: ```python import pandas as pd import numpy as np import re import jieba from gensim.models import Word2Vec # Step 1: 加载数据 def load_data(file_path): data = pd.read_csv(file_path) return data # Step 2: 数据预处理 def clean_text(text): # 去除标点符号 text = re.sub(r'[^\w\s]','',text) # 分词 seg_list = jieba.cut(text) # 去停用词 stopwords = open("stopwords.txt", "r", encoding="utf-8").read().split("\n") words = [word for word in seg_list if word not in stopwords] return words # Step 3: 构建词表和词向量 def build_word2vec_model(sentences): model = Word2Vec(sentences, size=100, window=5, min_count=5, workers=4) model.save("word2vec.model") return model # Step 4: 文本编码 def encode_text(text, vocab): return [vocab[word] for word in text if word in vocab] # Step 5: 提取文本特征向量 def extract_features(data): word2vec_model = Word2Vec.load("word2vec.model") vocab = word2vec_model.wv.vocab features = np.zeros((len(data), 100)) for i in range(len(data)): text = data.iloc[i]["text"] words = clean_text(text) sentence = encode_text(words, vocab) for word_index in sentence: features[i] += word2vec_model.wv[word_index] features[i] /= len(sentence) return features # 示例代码的使用 data = load_data("data.csv") sentences = data["text"].apply(clean_text).tolist() word2vec_model = build_word2vec_model(sentences) features = extract_features(data) ``` 在这段代码中,首先通过 `load_data` 函数加载数据。接着,使用 `clean_text` 函数进行数据预处理,包括去除标点符号、分词和去除停用词。然后,使用 `build_word2vec_model` 函数构建词表和词向量模型。接着,使用 `encode_text` 函数将文本编码成数字序列。最后,使用 `extract_features` 函数提取文本特征向量。需要注意的是,这里的 `vocab` 是从词向量模型中获取的。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值