Android Settings 按住电源按钮

如题,Android 原生 Settings 里有个 按住电源按钮 的选项,可以设置按住电源按钮的操作。
在这里插入图片描述

按住电源按钮

两个选项的 UI 是分离的,

电源菜单

代码在 packages/apps/Settings/src/com/android/settings/gestures/LongPressPowerForPowerMenuPreferenceController.java

/*
 * Copyright (C) 2022 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.gestures;

import android.content.Context;
import android.net.Uri;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.widget.SelectorWithWidgetPreference;

/**
 * Configures the behaviour of the radio selector to configure long press power button to Power
 * Menu.
 */
public class LongPressPowerForPowerMenuPreferenceController extends BasePreferenceController
        implements PowerMenuSettingsUtils.SettingsStateCallback,
                SelectorWithWidgetPreference.OnClickListener,
                LifecycleObserver {

    private SelectorWithWidgetPreference mPreference;
    private final PowerMenuSettingsUtils mUtils;

    public LongPressPowerForPowerMenuPreferenceController(Context context, String key) {
        super(context, key);
        mUtils = new PowerMenuSettingsUtils(context);
    }

    @Override
    public int getAvailabilityStatus() {
        return PowerMenuSettingsUtils.isLongPressPowerSettingAvailable(mContext)
                ? AVAILABLE
                : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        mPreference = screen.findPreference(getPreferenceKey());
        if (mPreference != null) {
            mPreference.setOnClickListener(this);
        }
    }

    @Override
    public void updateState(Preference preference) {
        super.updateState(preference);
        if (preference instanceof SelectorWithWidgetPreference) {
            ((SelectorWithWidgetPreference) preference)
                    .setChecked(
                            !PowerMenuSettingsUtils.isLongPressPowerForAssistantEnabled(mContext));
        }
    }

    @Override
    public void onRadioButtonClicked(SelectorWithWidgetPreference preference) {
        PowerMenuSettingsUtils.setLongPressPowerForPowerMenu(mContext);
        if (mPreference != null) {
            updateState(mPreference);
        }
    }

    @Override
    public void onChange(Uri uri) {
        if (mPreference != null) {
            updateState(mPreference);
        }
    }

    /** @OnLifecycleEvent(Lifecycle.Event.ON_START) */
    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    public void onStart() {
        mUtils.registerObserver(this);
    }

    /** @OnLifecycleEvent(Lifecycle.Event.ON_STOP) */
    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    public void onStop() {
        mUtils.unregisterObserver();
    }
}


关键代码,

    @Override
    public void onRadioButtonClicked(SelectorWithWidgetPreference preference) {
        PowerMenuSettingsUtils.setLongPressPowerForPowerMenu(mContext);
        if (mPreference != null) {
            updateState(mPreference);
        }
    }

数字助理

代码在 packages/apps/Settings/src/com/android/settings/gestures/LongPressPowerForAssistantPreferenceController.java

/*
 * Copyright (C) 2022 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.gestures;

import android.content.Context;
import android.net.Uri;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.widget.SelectorWithWidgetPreference;

/**
 * Configures the behaviour of the radio selector to configure long press power button to Assistant.
 */
public class LongPressPowerForAssistantPreferenceController extends BasePreferenceController
        implements PowerMenuSettingsUtils.SettingsStateCallback,
                SelectorWithWidgetPreference.OnClickListener,
                LifecycleObserver {

    private SelectorWithWidgetPreference mPreference;
    private final PowerMenuSettingsUtils mUtils;

    public LongPressPowerForAssistantPreferenceController(Context context, String key) {
        super(context, key);
        mUtils = new PowerMenuSettingsUtils(context);
    }

    @Override
    public int getAvailabilityStatus() {
        return PowerMenuSettingsUtils.isLongPressPowerSettingAvailable(mContext)
                ? AVAILABLE
                : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        mPreference = screen.findPreference(getPreferenceKey());
        if (mPreference != null) {
            mPreference.setOnClickListener(this);
        }
    }

    @Override
    public void updateState(Preference preference) {
        super.updateState(preference);
        if (preference instanceof SelectorWithWidgetPreference) {
            ((SelectorWithWidgetPreference) preference)
                    .setChecked(
                            PowerMenuSettingsUtils.isLongPressPowerForAssistantEnabled(mContext));
        }
    }

    @Override
    public void onRadioButtonClicked(SelectorWithWidgetPreference preference) {
        PowerMenuSettingsUtils.setLongPressPowerForAssistant(mContext);
        if (mPreference != null) {
            updateState(mPreference);
        }
    }

    @Override
    public void onChange(Uri uri) {
        if (mPreference != null) {
            updateState(mPreference);
        }
    }

    /** @OnLifecycleEvent(Lifecycle.Event.ON_START) */
    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    public void onStart() {
        mUtils.registerObserver(this);
    }

    /** @OnLifecycleEvent(Lifecycle.Event.ON_STOP) */
    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    public void onStop() {
        mUtils.unregisterObserver();
    }
}

关键代码,

    @Override
    public void onRadioButtonClicked(SelectorWithWidgetPreference preference) {
        PowerMenuSettingsUtils.setLongPressPowerForAssistant(mContext);
        if (mPreference != null) {
            updateState(mPreference);
        }
    }

功能设置

实际设置是在 packages/apps/Settings/src/com/android/settings/gestures/PowerMenuSettingsUtils.java

    private static final String POWER_BUTTON_LONG_PRESS_SETTING =
            Settings.Global.POWER_BUTTON_LONG_PRESS;

    private static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1; // a.k.a., Power Menu
    private static final int LONG_PRESS_POWER_ASSISTANT_VALUE = 5; // Settings.Secure.ASSISTANT

    // ... 
    public static boolean setLongPressPowerForAssistant(Context context) {
        if (Settings.Global.putInt(
                context.getContentResolver(),
                POWER_BUTTON_LONG_PRESS_SETTING,
                LONG_PRESS_POWER_ASSISTANT_VALUE)) {
            // Make power + volume up buttons to open the power menu
            Settings.Global.putInt(
                    context.getContentResolver(),
                    KEY_CHORD_POWER_VOLUME_UP_SETTING,
                    KEY_CHORD_POWER_VOLUME_UP_GLOBAL_ACTIONS);
            return true;
        }
        return false;
    }

    public static boolean setLongPressPowerForPowerMenu(Context context) {
        if (Settings.Global.putInt(
                context.getContentResolver(),
                POWER_BUTTON_LONG_PRESS_SETTING,
                LONG_PRESS_POWER_GLOBAL_ACTIONS)) {
            // We restore power + volume up buttons to the default action.
            int keyChordDefaultValue =
                    context.getResources()
                            .getInteger(KEY_CHORD_POWER_VOLUME_UP_DEFAULT_VALUE_RESOURCE);
            Settings.Global.putInt(
                    context.getContentResolver(),
                    KEY_CHORD_POWER_VOLUME_UP_SETTING,
                    keyChordDefaultValue);
            return true;
        }
        return false;
    }

追踪初始化逻辑

android.provider.Settings 相关调用的初始化一般都在 SettingsProvider 里,

找到 frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java

    /**
     * Correctly sets long press power button Behavior.
     *
     * The issue is that setting for LongPressPower button Behavior is not available on all devices
     * and actually changes default Behavior of two properties - the long press power button
     * and volume up + power button combo. OEM can also reconfigure these Behaviors in config.xml,
     * so we need to be careful that we don't irreversibly change power button Behavior when
     * restoring. Or switch to a non-default button Behavior.
     */
    private void setLongPressPowerBehavior(ContentResolver cr, String value) {
        // We will not restore the value if the long press power setting option is unavailable.
        if (!mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable)) {
            return;
        }

        int longPressOnPowerBehavior;
        try {
            longPressOnPowerBehavior = Integer.parseInt(value);
        } catch (NumberFormatException e) {
            return;
        }

        if (longPressOnPowerBehavior < LONG_PRESS_POWER_NOTHING
                || longPressOnPowerBehavior > LONG_PRESS_POWER_FOR_ASSISTANT) {
            return;
        }

        // When user enables long press power for Assistant, we also switch the meaning
        // of Volume Up + Power key chord to the "Show power menu" option.
        // If the user disables long press power for Assistant, we switch back to default OEM
        // Behavior configured in config.xml. If the default Behavior IS "LPP for Assistant",
        // then we fall back to "Long press for Power Menu" Behavior.
        if (longPressOnPowerBehavior == LONG_PRESS_POWER_FOR_ASSISTANT) {
            Settings.Global.putInt(cr, Settings.Global.POWER_BUTTON_LONG_PRESS,
                    LONG_PRESS_POWER_FOR_ASSISTANT);
            Settings.Global.putInt(cr, Settings.Global.KEY_CHORD_POWER_VOLUME_UP,
                    KEY_CHORD_POWER_VOLUME_UP_GLOBAL_ACTIONS);
        } else {
            // We're restoring "LPP for Assistant Disabled" state, prefer OEM config.xml Behavior
            // if possible.
            int longPressOnPowerDeviceBehavior = mContext.getResources().getInteger(
                    com.android.internal.R.integer.config_longPressOnPowerBehavior);
            if (longPressOnPowerDeviceBehavior == LONG_PRESS_POWER_FOR_ASSISTANT) {
                // The default on device IS "LPP for Assistant Enabled" so fall back to power menu.
                Settings.Global.putInt(cr, Settings.Global.POWER_BUTTON_LONG_PRESS,
                        LONG_PRESS_POWER_GLOBAL_ACTIONS);
            } else {
                // The default is non-Assistant Behavior, so restore that default.
                Settings.Global.putInt(cr, Settings.Global.POWER_BUTTON_LONG_PRESS,
                        longPressOnPowerDeviceBehavior);
            }

            // Clear and restore default power + volume up Behavior as well.
            int powerVolumeUpDefaultBehavior = mContext.getResources().getInteger(
                    com.android.internal.R.integer.config_keyChordPowerVolumeUp);
            Settings.Global.putInt(cr, Settings.Global.KEY_CHORD_POWER_VOLUME_UP,
                    powerVolumeUpDefaultBehavior);
        }
    }

找到 config_longPressOnPowerBehavior ,定义在 frameworks/base/core/res/res/values/config.xml

    <!-- Control the behavior when the user long presses the power button.
            0 - Nothing
            1 - Global actions menu
            2 - Power off (with confirmation)
            3 - Power off (without confirmation)
            4 - Go to voice assist
            5 - Go to assistant (Settings.Secure.ASSISTANT)
    -->
    <integer name="config_longPressOnPowerBehavior">5</integer>

按住电源按钮的持续时间

代码在 packages/apps/Settings/src/com/android/settings/gestures/LongPressPowerSensitivityPreferenceController.java

/*
 * Copyright (C) 2021 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.gestures;

import android.content.Context;
import android.net.Uri;
import android.provider.Settings;

import androidx.annotation.Nullable;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.settings.core.SliderPreferenceController;
import com.android.settings.widget.LabeledSeekBarPreference;

/** Handles changes to the long press power button sensitivity slider. */
public class LongPressPowerSensitivityPreferenceController extends SliderPreferenceController
        implements PowerMenuSettingsUtils.SettingsStateCallback, LifecycleObserver {

    @Nullable
    private final int[] mSensitivityValues;

    private final PowerMenuSettingsUtils mUtils;

    @Nullable
    private LabeledSeekBarPreference mPreference;

    public LongPressPowerSensitivityPreferenceController(Context context, String preferenceKey) {
        super(context, preferenceKey);
        mSensitivityValues = context.getResources().getIntArray(
                com.android.internal.R.array.config_longPressOnPowerDurationSettings);
        mUtils = new PowerMenuSettingsUtils(context);
    }

    /** @OnLifecycleEvent(Lifecycle.Event.ON_START) */
    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    public void onStart() {
        mUtils.registerObserver(this);
    }

    /** @OnLifecycleEvent(Lifecycle.Event.ON_STOP) */
    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    public void onStop() {
        mUtils.unregisterObserver();
    }

    @Override
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        mPreference = screen.findPreference(getPreferenceKey());
        if (mPreference != null) {
            mPreference.setContinuousUpdates(false);
            mPreference.setHapticFeedbackMode(
                    LabeledSeekBarPreference.HAPTIC_FEEDBACK_MODE_ON_TICKS);
            mPreference.setMin(getMin());
            mPreference.setMax(getMax());
        }
    }

    @Override
    public void updateState(Preference preference) {
        super.updateState(preference);
        final LabeledSeekBarPreference pref = (LabeledSeekBarPreference) preference;
        pref.setVisible(
                PowerMenuSettingsUtils.isLongPressPowerForAssistantEnabled(mContext)
                        && getAvailabilityStatus() == AVAILABLE);
        pref.setProgress(getSliderPosition());
    }

    @Override
    public int getAvailabilityStatus() {
        if (mSensitivityValues == null
                || mSensitivityValues.length < 2
                || !PowerMenuSettingsUtils.isLongPressPowerSettingAvailable(mContext)) {
            return UNSUPPORTED_ON_DEVICE;
        }
        return AVAILABLE;
    }

    @Override
    public int getSliderPosition() {
        return mSensitivityValues == null ? 0 : closestValueIndex(mSensitivityValues,
                getCurrentSensitivityValue());
    }

    @Override
    public boolean setSliderPosition(int position) {
        if (mSensitivityValues == null || position < 0 || position >= mSensitivityValues.length) {
            return false;
        }
        return Settings.Global.putInt(mContext.getContentResolver(),
                Settings.Global.POWER_BUTTON_LONG_PRESS_DURATION_MS,
                mSensitivityValues[position]);
    }

    @Override
    public void onChange(Uri uri) {
        if (mPreference != null) {
            updateState(mPreference);
        }
    }

    @Override
    public int getMax() {
        if (mSensitivityValues == null || mSensitivityValues.length == 0) {
            return 0;
        }
        return mSensitivityValues.length - 1;
    }

    @Override
    public int getMin() {
        return 0;
    }

    private int getCurrentSensitivityValue() {
        return Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.POWER_BUTTON_LONG_PRESS_DURATION_MS,
                mContext.getResources().getInteger(
                        com.android.internal.R.integer.config_longPressOnPowerDurationMs));
    }

    private static int closestValueIndex(int[] values, int needle) {
        int minDistance = Integer.MAX_VALUE;
        int valueIndex = 0;
        for (int i = 0; i < values.length; i++) {
            int diff = Math.abs(values[i] - needle);
            if (diff < minDistance) {
                minDistance = diff;
                valueIndex = i;
            }
        }
        return valueIndex;
    }
}

R.array.config_longPressOnPowerDurationSettings 定义在 frameworks/base/core/res/res/values/config.xml

    <!-- The possible UI options to be surfaced for configuring long press power on duration
         action. Value set in config_longPressOnPowerDurationMs should be one of the available
         options to allow users to restore default. -->
    <integer-array name="config_longPressOnPowerDurationSettings">
        <item>250</item>
        <item>350</item>
        <item>500</item>
        <item>650</item>
        <item>750</item>
    </integer-array>

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

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

相关文章

使用WebDriver采样器将JMeter与Selenium集成

第一步&#xff1a; 在JMeter中添加Selenium / WebDriver插件 第二步&#xff1a; 创建一条测试计划–添加线程组 添加配置元素 - jpgc - WebDriver Sampler 添加配置元素 - jpgc - Chrome Driver Config 并且添加监听器查看结果树 第三步&#xff1a; 下载 chromedriver…

威士忌的类型:从单一麦芽到混合威士忌

威士忌&#xff0c;这种源自苏格兰的特别蒸馏酒&#xff0c;如今已在全球范围内赢得了无数赞誉。其类型多样&#xff0c;从单一麦芽到混合威士忌&#xff0c;每一种都有其特别的特点和风味。本文将深入探讨不同类型的威士忌&#xff0c;以雷盛537威士忌的实例&#xff0c;分析其…

AWS 专题学习 P9 (API Gateway、Cognito、Serverless SA)

文章目录 专题总览API GatewayAPI Gateway – 高级集成API Gateway – AWS 服务集成API Gateway - Endpoint TypesAPI Gateway – 安全 AWS Step Functions&#xff08;AWS 步骤函数&#xff09;Amazon Cognito&#xff08;认证服务&#xff09;Cognito User Pools (CUP) – 用…

【云原生】Docker网络模式和Cgroup资源限制

目录 一、Docker 网络实现原理 二、Docker 的网络模式 #网络模式详解&#xff1a; 第一种&#xff1a;host模式 第二种&#xff1a;bridge模式 第三种&#xff1a;container模式 第四种&#xff1a;none模式 第五种&#xff1a;自定义网络 三、Cgroup资源控制 第一种&a…

中断与事件区别

自记&#xff1a; 以外部中断举例&#xff1a; 这张图是一条外部中断线或外部事件线的示意图, 图中信号线上划有一条斜线,旁边标志19字样的注释,表示这样的线路共有19套. 图中的蓝色虚线箭头,标出了外部中断信号的传输路径,首先外部信号从编号1的芯片管脚进入,经过编号2的边…

Java实现校园疫情防控管理系统 JAVA+Vue+SpringBoot+MySQL

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 学生2.2 老师2.3 学校管理部门 三、系统展示四、核心代码4.1 新增健康情况上报4.2 查询健康咨询4.3 新增离返校申请4.4 查询防疫物资4.5 查询防控宣传数据 五、免责说明 一、摘要 1.1 项目介绍 基于JAVAVueSpringBoot…

php实现多进程的几种方式

目录 一&#xff1a;使用pcntl扩展库 二&#xff1a;使用Swoole扩展 三&#xff1a;使用多进程模式PHP-FPM 在PHP中实现多进程主要有以下几种方式&#xff1a; 一&#xff1a;使用pcntl扩展库 pcntl扩展库提供了多线程相关的函数&#xff0c;如pcntl_fork()用于创建子进程…

vue常用指令(v-show)

一、v-show 指令 作用: 根据真假值,切换元素的显示状态 二、代码演示 1、v-show 绑定判断条件后&#xff0c;根据布尔值决定是否显示图片 不显示图片 代码 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8" /><…

pve8.1 安装、创建centos7虚拟机及配置

之前创建虚拟机centos7时&#xff0c;硬盘分配太大了&#xff0c;做成模板后无法进行修改了&#xff0c;安装完pve8.1后&#xff0c;强迫症犯了重新创建一下顺便记录一下配置过程。由于目前centos7还是生产用的比较多的版本所以本次还是安装centos7.9版本。 一、下载镜像 下载…

mysql 多版本并发控制mvcc

行级锁的一个变种避免了加锁&#xff0c;开销低非阻塞读操作&#xff0c;写操作是行级原理&#xff1a;使用数据在某个时间点的快照实现&#xff0c;不同事务在同一个时间可以看到同一个表中的不同数据。分类&#xff1a;乐观&#xff0c;悲观在一行中存储更多数据&#xff0c;…

VR数字展厅,平面静态跨越到3D立体化时代

近些年&#xff0c;VR的概念被越来越多的人提起&#xff0c;较为常见的形式就是VR数字展厅。VR数字展厅的出现&#xff0c;让各地以及各行业的展厅展馆的呈现和宣传都发生了很大的改变和革新&#xff0c;同时也意味着展览传播的方式不再局限于原来的图文、视频&#xff0c;而是…

统计学-R语言-7.4

文章目录 前言非参数检验两个独立样本的Mann-Whitney检验 练习 前言 本片是对非参数检验最后的介绍。 非参数检验 两个独立样本的Mann-Whitney检验 Mann -Whitney检验也称为Mann- Whitney U检验&#xff08;Mann-Whitney U test&#xff09;或称为 Wilcoxon秩和检验&#xf…

C++ Qt day2

自己封装一个矩形类(Rect)&#xff0c;拥有私有属性:宽度(width)、高度(height)&#xff0c; 定义公有成员函数: 初始化函数:void init(int w, int h) 更改宽度的函数:set_w(int w) 更改高度的函数:set_h(int h) 输出该矩形的周长和面积函数:void show() #include <io…

UDP 的报文结构和注意事项

1. UDP的特点 1.无连接 就像发短信给对方&#xff0c;只需要对方的端口和IP地址。不需要连接。 2.不可靠传输 没有任何安全机制&#xff0c;发送端发送数据报以后&#xff0c;如果因为⽹络故障该段⽆法发到对⽅&#xff0c;UDP协议层也不会给应⽤层返回任何错误信息。 3.面向…

Java PDFBox 提取页数、PDF转图片

PDF 提取 使用Apache 的pdfbox组件对PDF文件解析读取和转图片。 Maven 依赖 导入下面的maven依赖&#xff1a; <dependency><groupId>org.apache.pdfbox</groupId><artifactId>pdfbox</artifactId><version>2.0.30</version> &l…

import tensorflow.contrib.slim as slim中contrib报红,显示没有导入contrib

本人环境&#xff1a; python 3.6 tensorflow 1.13 问题如下图&#xff1a; 解决方法&#xff1a; 找到包的位置&#xff0c;查看tensorflow中是否下载了contrib包&#xff0c;如果有的话&#xff0c;建议重新装一次TensorFlow 如果没有找找&#xff0c;可以在搜索栏搜一下…

什么是5G RedCap?5G RedCap有什么优势?

5G RedCap&#xff08;Reduced Capability&#xff09;是指5G轻量化技术&#xff0c;即通过对5G技术进行一定程度的“功能裁剪”&#xff0c;来降低终端和模组的复杂度、成本、尺寸和功耗等指标&#xff0c;从而“量体裁衣”适配不同的物联需求&#xff0c;实现兼顾物联网系统的…

自锁设计更稳固,同为科技(TOWE)服务器电脑IEC 60320电源线

说起IEC 60320标准电源线&#xff0c;可能很多人不知道具体是什么东西&#xff0c;但要说到台式电脑电源线&#xff0c;那大家就都能耳熟能详了。IEC 60320电源线的用途十分广泛&#xff0c;包括家用电器、医疗设备、数据中心服务器、商业机械设备、自动化生产线等都是用此类电…

【iOS ARKit】人脸追踪之挂载虚拟元素

人脸跟踪&#xff08;Face Tracking&#xff09;是指将人脸检测扩展到视频序列&#xff0c;跟踪同一张人脸在视频序列中的位置。是论上讲&#xff0c;任何出现在视频中的人险都可以被跟踪&#xff0c;也即是说&#xff0c;在连续视频帧中检测到的人脸可以被识别为同一个人。人脸…

c++ 4种类型转换

1. 常量转换(const_cast)。》方便赋值 常量转换用于去掉表达式的const属性&#xff0c;使其变成非常量表达式&#xff0c;方便赋值。常量转换不能改变表达式的类型&#xff0c;只能改变const属性。示例代码&#xff1a; const int a 10; int b const_cast<int&>…