Android P 屏保和休眠相关知识

Android P添加屏保功能,如果休眠时间设定大于屏保时间,则先进入屏保,达到休眠时间后再进入休眠

需求:

  1. 添加屏幕互保开关,默认关闭。
  2. 只保留时钟,可设定指针和数字、夜间模式。
  3. 启用时间改多长时间无操作进入屏保,可设定1、5、10、15、30分钟。
  4. 如果休眠时间设定小于屏保时间,则优先进入休眠,如果休眠时间设定大于屏保时间,则先进入屏保,达到休眠时间后再进入休眠

修改后的屏保:

 

 分析与实现:

1.修改进入屏保的条件

由于Android原生系统默认进入屏保的条件是充电或插入基座时,但到达休眠时才进入屏保。所以需要把进入屏保的条件修改为任何时候都能进入。

frameworks\base\core\res\res\values\config.xml
把"config_dreamsEnabledOnBattery"修改为true即实现任何时候都能进入屏保<!-- Are we allowed to dream while not plugged in? --><bool name="config_dreamsEnabledOnBattery">true</bool>

2.在设置–>显示–>屏保中添加“屏幕互保”选项开关

2.1添加系统自定义全局变量,用来保存“屏幕互保”选项开关的状态值

frameworks/base/core/java/android/provider/Settings.java+        /** @hide */
+        public static final String SCREENSAVER_SWITCH= "seewo.screensavers.switch";
public static final class Secure extends NameValueTable {
/** @hide */
public static final String SCREENSAVER_TIMEOUT= “seewo.screensavers.timeout”;

2.2 vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/strings.xml

<string name="screensaver_switch_title">屏幕互保</string>

2.3 vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/dream_fragment_overview.xml

<PreferenceScreenxmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"android:key="dream_overview_screen"
<SwitchPreferenceandroid:key="screensaver_switch"android:title="@string/screensaver_switch_title"/>

2.4添加vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/dream/ScreenSaverSwitchPreferenceController.java文件

/** Copyright (C) 2017 The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file* except in compliance with the License. You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software distributed under the* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY* KIND, either express or implied. See the License for the specific language governing* permissions and limitations under the License.*/
package com.android.settings.dream;import static android.provider.Settings.Secure.SCREENSAVER_SWITCH;import android.content.Context;
import android.provider.Settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;public class ScreenSaverSwitchPreferenceController extends AbstractPreferenceControllerimplements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {private static final String KEY_SCREENSAVER_SWITCH_NAME = "screensaver_switch";public ScreenSaverSwitchPreferenceController(Context context) {super(context);}@Overridepublic boolean isAvailable() {return true;}@Overridepublic String getPreferenceKey() {return KEY_SCREENSAVER_SWITCH_NAME;}@Overridepublic boolean onPreferenceChange(Preference preference, Object newValue) {boolean value = (Boolean) newValue;Settings.Secure.putInt(mContext.getContentResolver(),KEY_SCREENSAVER_SWITCH_NAME, value ? 1 : 0);if (value) {Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.SCREENSAVER_SWITCH,1);} else {Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.SCREENSAVER_SWITCH,0);}return true;}@Overridepublic void updateState(Preference preference) {int value = Settings.Secure.getInt(mContext.getContentResolver(),KEY_SCREENSAVER_SWITCH_NAME, 0);((SwitchPreference) preference).setChecked(value == 1);}
}

2.5 vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/dream/DreamSettings.java

@@ -132,6 +132,7 @@ public class DreamSettings extends DashboardFragment {controllers.add(new StartNowPreferenceController(context));
+        controllers.add(new ScreenSaverSwitchPreferenceController(context));return controllers;

3.隐藏“启动时间”

--- a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/dream/StartNowPreferenceController.java
+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/dream/StartNowPreferenceController.java
@@ -40,7 +40,7 @@ public class StartNowPreferenceController extends AbstractPreferenceController i@Overridepublic boolean isAvailable() {
-        return true;
+        return false;}

4.添加选择无操作多少分钟后进入屏保的ListPreference

4.1添加系统自定义全局变量,用来保存无操作多少分钟后进入屏保的时间。
frameworks/base/core/java/android/provider/Settings.java

 public static final class Secure extends NameValueTable {/** @hide */public static final String SCREENSAVER_TIMEOUT= "seewo.screensavers.timeout";

4.2设置–>显示–>屏保中添加ListPreference
vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/dream_fragment_overview.xml

+    <ListPreference
+        android:key="screensaver_timeout"
+        android:title="@string/screensaver_timeout"
+        android:entries="@array/screensaver_timeout_entries"
+        android:entryValues="@array/screensaver_timeout_values"
+        settings:controller="com.android.settings.dream.ScreenSaverTimeoutPreferenceController" />

vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values/arrays.xml

+    <!--  Titles for screensaver preference. -->
+    <string-array name="screensaver_timeout_entries" >
+        <item>@string/screensaver_timeout_1min</item>
+        <item>@string/screensaver_timeout_5mins</item>
+        <item>@string/screensaver_timeout_10mins</item>
+        <item>@string/screensaver_timeout_15mins</item>
+        <item>@string/screensaver_timeout_30mins</item>
+    </string-array>
+
+    <!--  Values for screensaver preference. -->
+    <string-array name="screensaver_timeout_values" translatable="false" >
+        <item>60000</item>
+        <item>300000</item>
+        <item>600000</item>
+        <item>900000</item>
+        <item>1800000</item>
+    </string-array>

vendor/mediatek/proprietary/packages/apps/MtkSettings/res/values-zh-rCN/strings.xml

+    <string name="screensaver_timeout">屏保</string>
+    <string name="screensaver_timeout_1min">1 分钟</string>
+    <string name="screensaver_timeout_5mins">5 分钟</string>
+    <string name="screensaver_timeout_10mins">10 分钟</string>
+    <string name="screensaver_timeout_15mins">15 分钟</string>
+    <string name="screensaver_timeout_30mins">30 分钟</string>
+    <string name="screensaver_timeout_summary">"无操作<xliff:g id="TIMEOUT_DESCRIPTION">%1$s</xliff:g>后"</string>
+    <string name="screensaver_switch_title">屏幕互保</string>

4.3添加vendor\mediatek\proprietary\packages\apps\MtkSettings\src\com\android\settings\dream\ScreenSaverTimeoutPreferenceController.java

/** Copyright (C) 2018 The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License*/package com.android.settings.dream;import static android.provider.Settings.Secure.SCREENSAVER_TIMEOUT;import android.content.Context;
import android.provider.Settings;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.util.FeatureFlagUtils;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;
/*** Setting where user can pick if SystemUI will be light, dark or try to match* the wallpaper colors.*/
public class ScreenSaverTimeoutPreferenceController extends BasePreferenceControllerimplements Preference.OnPreferenceChangeListener {private ListPreference mScreenSaverTimeoutPref;public ScreenSaverTimeoutPreferenceController(Context context, String preferenceKey) {super(context, preferenceKey);}@Overridepublic int getAvailabilityStatus() {return AVAILABLE;}@Overridepublic void displayPreference(PreferenceScreen screen) {super.displayPreference(screen);mScreenSaverTimeoutPref = (ListPreference) screen.findPreference(getPreferenceKey());int value = Settings.Secure.getInt(mContext.getContentResolver(), SCREENSAVER_TIMEOUT, 60000);mScreenSaverTimeoutPref.setValue(Integer.toString(value));}@Overridepublic boolean onPreferenceChange(Preference preference, Object newValue) {int value = Integer.parseInt((String) newValue);Settings.Secure.putInt(mContext.getContentResolver(), SCREENSAVER_TIMEOUT, value);refreshSummary(preference);return true;}@Overridepublic CharSequence getSummary() {int value = Settings.Secure.getInt(mContext.getContentResolver(), SCREENSAVER_TIMEOUT, 60000);int index = mScreenSaverTimeoutPref.findIndexOfValue(Integer.toString(value));return mContext.getString(R.string.screensaver_timeout_summary, mScreenSaverTimeoutPref.getEntries()[index]);}
}

5.屏保默认为原生时钟,移除“万花筒”

5.1 原生屏保默认是使用Google GMS中的时钟,因此修改为默认使用原生的时钟。
frameworks/base/core/res/res/values/config.xml

-    <string name="config_dreamsDefaultComponent" translatable="false">com.google.android.deskclock/com.android.deskclock.Screensaver</string>
+    <string name="config_dreamsDefaultComponent" translatable="false">com.android.deskclock/com.android.deskclock.Screensaver</string>

5.2移除“万花筒”
vendor/mediatek/proprietary/packages/apps/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java

     public List<DreamInfo> getDreamInfos() {logd("getDreamInfos()");
+        String componentName;//del basic.ColorsComponentName activeDream = getActiveDream();PackageManager pm = mContext.getPackageManager();Intent dreamIntent = new Intent(DreamService.SERVICE_INTERFACE);
@@ -124,6 +125,12 @@ public class DreamBackend {dreamInfo.caption = resolveInfo.loadLabel(pm);dreamInfo.icon = resolveInfo.loadIcon(pm);dreamInfo.componentName = getDreamComponentName(resolveInfo);
+            componentName = dreamInfo.componentName.toString();
+            if(componentName.contains("com.android.dreams.basic.Colors")){
+                continue;
+            }dreamInfo.isActive = dreamInfo.componentName.equals(activeDream);

6.定制屏保时间

如果休眠时间设定小于屏保时间,则优先进入休眠,如果休眠时间设定大于屏保时间,则先进入屏保,达到休眠时间后再进入休眠的实现
frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java

6.1修改进入屏保的条件由Setting中的“屏幕互保”选项的开或关来决定

 private boolean updateWakefulnessLocked(int dirty) {boolean changed = false;if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_BOOT_COMPLETED| DIRTY_WAKEFULNESS | DIRTY_STAY_ON | DIRTY_PROXIMITY_POSITIVE| DIRTY_DOCK_STATE)) != 0) {if (mWakefulness == WAKEFULNESS_AWAKE && isItBedTimeYetLocked()) {if (DEBUG_SPEW) {Slog.d(TAG, "updateWakefulnessLocked: Bed time...");}final long time = SystemClock.uptimeMillis();if (shouldNapAtBedTimeLocked()) {//此处为进入屏保的条件changed = napNoUpdateLocked(time, Process.SYSTEM_UID);} else {changed = goToSleepNoUpdateLocked(time,PowerManager.GO_TO_SLEEP_REASON_TIMEOUT, 0, Process.SYSTEM_UID);}}}return changed;}

shouldNapAtBedTimeLocked()为进入屏保的条件,所以需要修改shouldNapAtBedTimeLocked()的返回值。

    private boolean shouldNapAtBedTimeLocked() {
-        return mDreamsActivateOnSleepSetting
-                || (mDreamsActivateOnDockSetting
-                        && mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED);
+        return Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.SCREENSAVER_SWITCH,0) == 1;
+        //return mDreamsActivateOnSleepSetting
+        //        || (mDreamsActivateOnDockSetting
+        //                && mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED);}

Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.SCREENSAVER_SWITCH,0)是获取“屏幕互保”的状态值,1表示打开,0表示关闭。

6.2修改取决于什么时候进入屏保的逻辑。

 private void updateUserActivitySummaryLocked(long now, int dirty) {// Update the status of the user activity timeout timer.if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY| DIRTY_WAKEFULNESS | DIRTY_SETTINGS)) != 0) {mHandler.removeMessages(MSG_USER_ACTIVITY_TIMEOUT);long nextTimeout = 0;long screenSaverNextTimeout = 0;//添加计算下次进入屏保的时间boolean isScreenSaverEnabled = Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.SCREENSAVER_SWITCH,0) == 1;//获取“屏幕互保”是否打开if (mWakefulness == WAKEFULNESS_AWAKE|| mWakefulness == WAKEFULNESS_DREAMING|| mWakefulness == WAKEFULNESS_DOZING) {final long sleepTimeout = getSleepTimeoutLocked();final long screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout);//无操作多少分钟后进入休眠的时间final long screenDimDuration = getScreenDimDurationLocked(screenOffTimeout);final boolean userInactiveOverride = mUserInactiveOverrideFromWindowManager;final long nextProfileTimeout = getNextProfileTimeoutLocked(now);final long screenSaverTimeout = Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.SCREENSAVER_TIMEOUT,60000);//无操作多少分钟后进入屏保的时间mUserActivitySummary = 0;if (mLastUserActivityTime >= mLastWakeTime) {nextTimeout = mLastUserActivityTime+ screenOffTimeout - screenDimDuration;screenSaverNextTimeout = mLastUserActivityTime + screenSaverTimeout;//无操作后下次进入屏保的时间if (now < nextTimeout) {//当“屏幕互保”是打开的,并且无操作后进入休眠的时间 大于 无操作后进入屏保的时间,//而且当前的时间 大于 无操作后下次进入屏保的时间则进入屏保if(isScreenSaverEnabled && screenOffTimeout > screenSaverTimeout && now > screenSaverNextTimeout ){mUserActivitySummary = USER_ACTIVITY_SCREEN_DREAM;}else{//否则保持屏保亮屏mUserActivitySummary = USER_ACTIVITY_SCREEN_BRIGHT;}//Neostra dangziming end screensaver} else {nextTimeout = mLastUserActivityTime + screenOffTimeout;if (now < nextTimeout) {mUserActivitySummary = USER_ACTIVITY_SCREEN_DIM;}}}if (mUserActivitySummary == 0&& mLastUserActivityTimeNoChangeLights >= mLastWakeTime) {nextTimeout = mLastUserActivityTimeNoChangeLights + screenOffTimeout;if (now < nextTimeout) {if (mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_BRIGHT|| mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_VR) {mUserActivitySummary = USER_ACTIVITY_SCREEN_BRIGHT;} else if (mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_DIM) {mUserActivitySummary = USER_ACTIVITY_SCREEN_DIM;}}}if (mUserActivitySummary == 0) {if (sleepTimeout >= 0) {final long anyUserActivity = Math.max(mLastUserActivityTime,mLastUserActivityTimeNoChangeLights);if (anyUserActivity >= mLastWakeTime) {nextTimeout = anyUserActivity + sleepTimeout;if (now < nextTimeout) {mUserActivitySummary = USER_ACTIVITY_SCREEN_DREAM;}}} else {//mUserActivitySummary = USER_ACTIVITY_SCREEN_DREAM;//删除系统进入休眠后才进入屏保的逻辑nextTimeout = -1;}}if (mUserActivitySummary != USER_ACTIVITY_SCREEN_DREAM && userInactiveOverride) {if ((mUserActivitySummary &(USER_ACTIVITY_SCREEN_BRIGHT | USER_ACTIVITY_SCREEN_DIM)) != 0) {// Device is being kept awake by recent user activityif (nextTimeout >= now && mOverriddenTimeout == -1) {// Save when the next timeout would have occurredmOverriddenTimeout = nextTimeout;}}mUserActivitySummary = USER_ACTIVITY_SCREEN_DREAM;nextTimeout = -1;}if (nextProfileTimeout > 0) {nextTimeout = Math.min(nextTimeout, nextProfileTimeout);}if (mUserActivitySummary != 0 && nextTimeout >= 0) {//当“屏幕互保”是打开的,并且无操作后进入休眠的时间 大于 无操作后进入屏保的时间,//而且当前的时间 大于 无操作后下次进入屏保的时间则发送信息进入屏保if(isScreenSaverEnabled && screenOffTimeout > screenSaverTimeout && now <= screenSaverNextTimeout ){scheduleUserInactivityTimeout(screenSaverNextTimeout);}else{//否则发送进入休眠的信息scheduleUserInactivityTimeout(nextTimeout);}//Neostra dangziming end screensaver}} else {mUserActivitySummary = 0;}if (DEBUG_SPEW) {Slog.d(TAG, "updateUserActivitySummaryLocked: mWakefulness="+ PowerManagerInternal.wakefulnessToString(mWakefulness)+ ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary)+ ", nextTimeout=" + TimeUtils.formatUptime(nextTimeout));}}}

updateUserActivitySummaryLocked()的逻辑分析可以参考Android 8.1 PowerManagerService分析(二) ——updatePowerStateLocked()方法

如果此文章解答了您的相关疑惑,节约了您的宝贵时间,可以赏小编鸡腿哟!

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/654567.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

###C语言程序设计-----C语言学习(6)#

前言&#xff1a;感谢老铁的浏览&#xff0c;希望老铁可以一键三连加个关注&#xff0c;您的支持和鼓励是我前进的动力&#xff0c;后续会分享更多学习编程的内容。 一. 主干知识的学习 1. while语句 除了for语句以外&#xff0c;while语句也用于实现循环&#xff0c;而且它…

初识elasticsearch

一、了解ES 1.1.elasticsearch的作用 elasticsearch是一款非常强大的开源搜索引擎&#xff0c;具备非常多强大功能&#xff0c;可以帮助我们从海量数据中快速找到需要的内容 例如&#xff1a; 在GitHub搜索代码 在电商网站搜索商品 在百度搜索答案 在打车软件搜索附近的车 …

(七)for循环控制

文章目录 用法while的用法for的用法两者之间的联系可以相互等价用for改写while示例for和while的死循环怎么写for循环见怪不怪表达式1省略第一.三个表达式省略&#xff08;for 改 while&#xff09;全省略即死循环&#xff08;上面已介绍&#xff09; 用法 类比学习while语句 …

MySQL原理(一)架构组成(1)物理文件组成

目录 一、日志文件 1、错误日志 Error Log 1.1、作用&#xff1a; 1.2、开启关闭&#xff1a; 1.3、使用 2、二进制日志 Binary Log & Binary Log Index 2.1、作用&#xff1a; 2.2、开启关闭&#xff1a; 2.3、Binlog还有一些附加选项参数 &#xff08;1&#x…

江科大stm32学习笔记6——GPIO输入准备

一、按键消抖 由于按键内部使用的是机械式弹簧片&#xff0c;所以在按下和松开时会产生5~10ms的抖动&#xff0c;需要通过代码来进行消抖。 二、滤波电容 在电路中&#xff0c;如果见到一端接在电路中&#xff0c;一端接地的电容&#xff0c;则可以考虑它的作用为滤波电容&am…

linux -- 内存管理 -- 页面分配器

linux内存管理 为什么要了解linux内存管理 分配并使用内存&#xff0c;是内核程序与驱动程序中非常重要的一环。内存分配函数都依赖于内核中一个非常复杂而重要的组件 - 内存管理。 linux驱动程序不可避免要与内核中的内存管理模块打交道。 linux内存管理可以总体上分为两大…

MYSQL基本查询(CURD:创建、读取、更新、删除)

文章目录 前言一、Create1.全列插入2.指定列插入3.插入否则更新4.替换 二、Retrieve1.SELECT列2.WHERE条件3.结果排序4.筛选分页结果 三、Update四、Delete1.删除数据2.截断表 五、插入查询结果六、聚合函数 前言 操作关系型数据库的编程语言&#xff0c;定义了一套操作关系型…

Unity中URP下额外灯角度衰减

文章目录 前言一、额外灯中聚光灯的角度衰减二、AngleAttenuation函数的传入参数1、参数&#xff1a;spotDirection.xyz2、_AdditionalLightsSpotDir3、参数&#xff1a;lightDirection4、参数&#xff1a;distanceAndSpotAttenuation.zw5、_AdditionalLightsAttenuation 三、A…

Spring Security关键之5张数据表与7张表 !!!

一、什么是认证和授权&#xff1a; 认证&#xff1a;系统提供的用于识别用户身份的功能&#xff0c;通常提供用户名和密码进行登录其实就是在进行认证&#xff0c;认证的目的是让系统知道你是谁。授权&#xff1a;用户认证成功后&#xff0c;需要为用户授权&#xff0c;其实就…

全连MGRE(OSPF)综合实验

一.要求 二.底层--所有节点拥有合法ip地址 r1: r2&#xff08;isp&#xff09;: r3: r4: r5: r6: 三.全网可达 r1: r3&#xff1a; r4: r5: r6: 四.构建全连的MGRE环境 R1-R3-R4 R1&#xff1a; r3: r4: R1-R5-R6 r1: r5: r6: 五.ospf配置 R1&#xff1a; r3: r4: r5: r6:…

Qt应用软件【串口篇】串口通信

文章目录 1.串口概述2.串口传输数据的基本原理电信号的传输过程 3.串口的几个概念数据位&#xff08;Data Bits&#xff09;奇偶校验位&#xff08;Parity Bit&#xff09;停止位&#xff08;Stop Bits&#xff09;流控制&#xff08;Flow Control&#xff09;波特率&#xff0…

142. 环形链表 II(力扣LeetCode)

文章目录 142. 环形链表 II题目描述解题思路判断链表是否有环如果有环&#xff0c;如何找到这个环的入口 c代码 142. 环形链表 II 题目描述 给定一个链表的头节点 head &#xff0c;返回链表开始入环的第一个节点。 如果链表无环&#xff0c;则返回 null。 如果链表中有某个…

7.【SpringBoot3】项目部署、属性配置、多环境开发

文章目录 1. SpringBoot 项目部署2. 属性配置方式2.1 通过 cmd 命令行配置2.2 通过环境变量配置2.3 通过外部配置文件来配置 3. 多环境开发 Profiles3.1 多环境开发的单文件配置3.2 多环境开发的多文件配置3.3 多环境开发-分组 1. SpringBoot 项目部署 项目完成后&#xff0c;…

LLM大模型x知识图谱2024最新SOTA方案【附开源代码】

大模型LLM与知识图谱KG的结合可以充分发挥两者的优势&#xff0c;例如LLMs的通用知识和语言处理能力&#xff0c;以及KGs的结构化和准确性。这种结合不仅能够提升模型的知识处理能力&#xff0c;还能够在多个层面上优化模型的性能&#xff0c;更好地解决各种现实世界的问题&…

新火种AI|Taylor Swift不雅照被疯传!AI背后的隐患和危机引人深思...

作者&#xff1a;小岩 编辑&#xff1a;彩云 如今本就是一个信息爆炸的年代&#xff0c;再伴随2023年AI技术的井喷式发展&#xff0c;AI正在以迅雷不及掩耳之势渗透到我们生活的方方面面。不过&#xff0c;AI技术是一把双刃剑&#xff0c;我们在享受AI技术带来的便捷和实用的…

代码随想录刷题笔记 DAY17 | 平衡二叉树 No.110 | 二叉树的所有路径 No.257 | 左叶子之和 No.404

Day 17 01. 平衡二叉树&#xff08;No. 110&#xff09; 题目链接 代码随想录题解 1.1 题目 给定一个二叉树&#xff0c;判断它是否是高度平衡的二叉树。 本题中&#xff0c;一棵高度平衡二叉树定义为&#xff1a; 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超…

LabVIEW直流电机转速检测与控制

研究了使用LabVIEW软件和ELVIS实验平台来检测和控制直流电机的转速。通过集成光电传感器和霍尔传感器&#xff0c;实现了对电机转速的精确测量和调节。 系统组成&#xff1a;系统由NI ELVIS实验平台、光电传感器、霍尔传感器和直流电机组成。通过这些硬件元件&#xff0c;系统…

架构篇19:单服务器高性能模式-Reactor与Proactor

文章目录 ReactorProactor小结上篇介绍了单服务器高性能的 PPC 和 TPC 模式,它们的优点是实现简单,缺点是都无法支撑高并发的场景,尤其是互联网发展到现在,各种海量用户业务的出现,PPC 和 TPC 完全无能为力。今天我将介绍可以应对高并发场景的单服务器高性能架构模式:Rea…

如何本地搭建Tale博客网站并发布到公网分享好友远程访问——“cpolar内网穿透”

文章目录 前言1. Tale网站搭建1.1 检查本地环境1.2 部署Tale个人博客系统1.3 启动Tale服务1.4 访问博客地址 2. Linux安装Cpolar内网穿透3. 创建Tale博客公网地址4. 使用公网地址访问Tale 前言 今天给大家带来一款基于 Java 语言的轻量级博客开源项目——Tale&#xff0c;Tale…

C/C++编码问题研究

文章目录 一、Unicode字符集与U8/U16/U32编码二、编码1. 占字节数2. ASCII、GB2312、GBK、GB18030 以及 UTF8 的关系3. BOM4. UTF-8的存储实现 三、编译器字符集设置1. GCC语法Example 2. MSVC语法Example 三、wchar_t五、编码转换函数六、代码 & 实践1. UTF8与UTF16、UTF3…