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

<PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:key="dream_overview_screen"
<SwitchPreference
        android: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 AbstractPreferenceController
        implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {

    private static final String KEY_SCREENSAVER_SWITCH_NAME = "screensaver_switch";

    public ScreenSaverSwitchPreferenceController(Context context) {
        super(context);
    }

    @Override
    public boolean isAvailable() {
        return true;
    }

    @Override
    public String getPreferenceKey() {
        return KEY_SCREENSAVER_SWITCH_NAME;
    }

    @Override
    public 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;
    }

    @Override
    public 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
 
     @Override
     public 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 BasePreferenceController
        implements Preference.OnPreferenceChangeListener {

    private ListPreference mScreenSaverTimeoutPref;

    public ScreenSaverTimeoutPreferenceController(Context context, String preferenceKey) {
        super(context, preferenceKey);
    }

    @Override
    public int getAvailabilityStatus() {
        return AVAILABLE;
    }

    @Override
    public 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));
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        int value = Integer.parseInt((String) newValue);
        Settings.Secure.putInt(mContext.getContentResolver(), SCREENSAVER_TIMEOUT, value);
        refreshSummary(preference);
        return true;
    }

    @Override
    public 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.Colors
         ComponentName 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 activity
                        if (nextTimeout >= now && mOverriddenTimeout == -1) {
                            // Save when the next timeout would have occurred
                            mOverriddenTimeout = 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()方法

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Microsoft Visual Studio 2022的安装与使用

1 软件介绍 Microsoft Visual Studio 2022是Microsoft Visual Studio软件的一个高版本&#xff0c;能够编写和执行C/C代码&#xff0c;具有强大的功能&#xff0c;是开发C/C程序的主流软件。 Microsoft Visual Studio 2022有三个版本&#xff0c;分别是社区版&#xff08;Commu…

ACDSee 2024旗舰版 下载安装汉化教程,ACDSee 最新版,附安装包和工具,全网最简单,轻松搞的安装,无套路

前言 ACDSee是一款数字资产管理、图片管理编辑工具软件&#xff0c;提供良好的操作界面&#xff0c;简单人性化的操作方式&#xff0c;优质的快速图形解码方式&#xff0c;支持丰富的RAW格式&#xff0c;强大的图形文件管理功能等。 准备工作 1、提前准备好 ACDSee 2024 安装…

手把手教你优雅的安装虚拟机 Ubuntu —— 图文并茂

目录 Ubuntu 获取Vmware 安装新建虚拟机Ubuntu 安装虚拟机工具安装更多内容 本文教你如何优雅的在虚拟机中安装 Ubuntu&#xff0c;图文并茂、包教包会&#xff01; Ubuntu 获取 Ubuntu 官网镜像下载速度较慢&#xff0c;建议从国内镜像网站下载&#xff0c;如网易、中科大、…

针对于vue element-plus组件的el-date-picker日期区间组件的日期格式问题以及如何进行区间判断

<template><el-date-picker v-model"value1" type"daterange" range-separator"To" start-placeholder"开始日期" end-placeholder"结束日期" :size"size" change"sarend" /> </templat…

【网站项目】基于SSM的231论文投稿系统

&#x1f64a;作者简介&#xff1a;拥有多年开发工作经验&#xff0c;分享技术代码帮助学生学习&#xff0c;独立完成自己的项目或者毕业设计。 代码可以私聊博主获取。&#x1f339;赠送计算机毕业设计600个选题excel文件&#xff0c;帮助大学选题。赠送开题报告模板&#xff…

《合成孔径雷达成像算法与实现》Figure5.19

clc clear close all距离向参数 R_eta_c 20e3; % 景中心斜距 Tr 25e-6; % 发射脉冲时宽 Kr 0.25e12; % 距离向调频率 Fr 7.5e6; % 距离向采样率 Nrg 256; % 距离线采样点数 Bw abs(Kr*Tr); …

【word visio绘图】关闭visio两线交叉的跳线(跨线)

【visio绘图】关闭visio两线交叉的跳线&#xff08;跨线&#xff09; 1 如何在Visio绘图中关闭visio两线交叉的跳线&#xff08;跨线&#xff09;第一步&#xff1a;打开Visio并创建您的图形第二步&#xff1a;绘制您的连接线第三步&#xff1a;关闭跳线第四步&#xff1a;手动…

XSS_Labs靶场通关笔记

每一关的方法不唯一&#xff1b;可以结合源码进行分析后构造payload&#xff1b; 通关技巧&#xff08;四步&#xff09;&#xff1a; 1.输入内容看源码变化&#xff1b; 2.找到内容插入点&#xff1b; 3.测试是否有过滤&#xff1b; 4.构造payload绕过 第一关 构造paylo…

软件设计师——计算机网络(四)

&#x1f4d1;前言 本文主要是【计算机网络】——软件设计师——计算机网络的文章&#xff0c;如果有什么需要改进的地方还请大佬指出⛺️ &#x1f3ac;作者简介&#xff1a;大家好&#xff0c;我是听风与他&#x1f947; ☁️博客首页&#xff1a;CSDN主页听风与他 &#x1…

【心得】java JNDI配合RMI实现注入个人笔记

目录 JNDI RMI 基本概念 RMI 基本逻辑 恶意利用 JNDI注入RMI实现攻击 JNDI Java Naming and Directory Interface Java 命令和目录接口 让配置参数 和 代码 解耦的规范或者思想 低耦合 高内聚 Name 命名 java对象 通过 命名 绑定到 容器环境 java对象和一个特定的…

二分算法模版

二分算法模版 实数二分算法模版实数二分模版题 整数二分算法模版向上取整二分模版向下取整二分模版二分模版的注意点二分模版中check函数的实现能够使用二分的条件 二分主要分两类&#xff0c; 一类是对实数进行二分&#xff0c;一类是对整数进行二分 对整数二分又分成2种&…

分布式id-Leaf算法

一、介绍 由美团开发&#xff0c;开源项目链接&#xff1a;https://github.com/Meituan-Dianping/Leaf Leaf同时支持号段模式和snowflake算法模式&#xff0c;可以切换使用。ID号码是趋势递增的8byte的64位数字&#xff0c;满足上述数据库存储的主键要求。 Leaf的snowflake模…

谷歌vue插件安装包

链接&#xff1a;https://pan.baidu.com/s/1wTCqn7ttc-rF_wZScfEgPw?pwde7k6 提取码&#xff1a;e7k6 修改D:\谷歌浏览器插件安装包\devtools-main\packages\shell-chrome下manifest.json文件 将里面这四个文件地址改为src下面&#xff0c;因为地址在src下&#xff0c;直接…

Unity中URP下逐顶点光照

文章目录 前言一、之前额外灯逐像素光照的数据准备好后&#xff0c;还有最后的处理二、额外灯的逐顶点光照1、逐顶点额外灯的光照颜色2、inputData.vertexLighting3、surfaceData.albedo 前言 在上篇文章中&#xff0c;我们分析了Unity中URP下额外灯&#xff0c;逐像素光照中聚…

【RTP】webrtc 学习2: webrtc对h264的rtp打包

切片只是拷贝帧的split的各个部分到新的rtp 包的封装中。并没有在rtp包本身标记是否为关键帧FU-A 切片 输入的H.264 数据进行split :SplitNalu SplitNalu : 按照最大1200字节进行切分 切分后会返回一个数组 对于FU-A :split的数据总大小是 去掉一个字节的nalu header size …

高德地图实现-微信小程序地图导航

效果图&#xff1a; 一、准备阶段 1、在高德开放平台注册成为开发者2、申请开发者密钥&#xff08;key&#xff09;。3、下载并解压高德地图微信小程序SDK 高德开放平台&#xff1a; 注册账号(https://lbs.amap.com/)) 申请小程序应用的 key 应用管理(https://console.ama…

数据结构-顺序表详解专题

目录 顺序表 1.简单了解顺序表 2.顺序表的分类 2.1静态顺序表 2.2动态顺序表 2.3typedef命名作用 3.动态顺序表的实现 SeqList.h SeqList.c test.c 顺序表 1.简单了解顺序表 顺序表是线性表的一种&#xff0c;线性表是在逻辑上是线性结构&#xff0c;在物理逻辑上并…

【数据结构】栈、队列、数组、列表

数据结构是什么&#xff1f; 数据结构是计算机存储、组织数据的方式 是指数据相互之间是以什么方式排列在一起的。 数据结构是为了更加方便的管理和使用数据&#xff0c;需要结合具体的业务场景来进行选择。一般情况下&#xff0c;精心选择的数据结构可以带来更高的运行或者…

【CSS】实现鼠标悬停图片放大的几种方法

1.背景图片放大 使用css设置背景图片大小100%&#xff0c;同时设置位置和过渡效果&#xff0c;然后使用&#xff1a;hover设置当鼠标悬停时修改图片大小&#xff0c;实现悬停放大效果。 <!DOCTYPE html> <html lang"en"> <head><meta charset…

LVGL入门

一.GUI简介 GUI&#xff0c;全称为图形用户界面&#xff08;Graphical User Interface&#xff09;&#xff0c;是一种通过图形方式与计算机操作系统进行交互的界面。它通过在屏幕上显示图形元素如窗口、按钮、菜单等来代表计算机程序的功能和操作。 GUI的主要特点包括&#…