当前位置: 首页 > news >正文

黄岩做网站xp怎么做网站

黄岩做网站,xp怎么做网站,网上代理 建网站,销售crm前言 高版本的android设备,在remount之后,如果再进行ota升级,会产生异常,从而无法升级成功。 如何判断设备是否remount 当前已android 10 平台为例 当我们执行 adb remount 时,系统调用会调用到system/core/adb/dae…

前言

高版本的android设备,在remount之后,如果再进行ota升级,会产生异常,从而无法升级成功。

如何判断设备是否remount

当前已android 10 平台为例
当我们执行 adb remount 时,系统调用会调用到system/core/adb/daemon/remount_service.cpp

/** Copyright (C) 2008 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.*/#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string>#include "adb.h"
#include "adb_io.h"
#include "adb_unique_fd.h"static constexpr char kRemountCmd[] = "/system/bin/remount";static bool do_remount(int fd, const std::string& cmd) {if (getuid() != 0) {WriteFdExactly(fd, "Not running as root. Try \"adb root\" first.\n");return false;}auto pid = fork();if (pid < 0) {WriteFdFmt(fd, "Failed to fork to %s: %s\n", kRemountCmd, strerror(errno));return false;}if (pid == 0) {// child side of the forkdup2(fd, STDIN_FILENO);dup2(fd, STDOUT_FILENO);dup2(fd, STDERR_FILENO);execl(kRemountCmd, kRemountCmd, cmd.empty() ? nullptr : cmd.c_str(), nullptr);_exit(errno);}int wstatus = 0;auto ret = waitpid(pid, &wstatus, 0);if (ret == -1) {WriteFdFmt(fd, "Failed to wait for %s: %s\n", kRemountCmd, strerror(errno));return false;} else if (ret != pid) {WriteFdFmt(fd, "pid %d and waitpid return %d do not match for %s\n",static_cast<int>(pid), static_cast<int>(ret), kRemountCmd);return false;}if (WIFSIGNALED(wstatus)) {WriteFdFmt(fd, "%s terminated with signal %s\n", kRemountCmd,strsignal(WTERMSIG(wstatus)));return false;}if (!WIFEXITED(wstatus)) {WriteFdFmt(fd, "%s stopped with status 0x%x\n", kRemountCmd, wstatus);return false;}if (WEXITSTATUS(wstatus)) {WriteFdFmt(fd, "%s exited with status %d\n", kRemountCmd, WEXITSTATUS(wstatus));return false;}return true;
}void remount_service(unique_fd fd, const std::string& cmd) {const char* success = do_remount(fd.get(), cmd) ? "succeeded" : "failed";WriteFdFmt(fd.get(), "remount %s\n", success);
}

当前的思路时,再执行do_remount 函数时,添加一个persist变量来判断记录已经remount了,并记录remount次数。
具体修改如下:

#include <unistd.h>
//add 
#include <android-base/properties.h>
//add 
#include <string>
......static bool do_remount(int fd, const std::string& cmd) {......//add std::string prop = android::base::GetProperty("persist.sys.remount.count", "0");int count  = std::stoi(prop) + 1;android::base::SetProperty("persist.sys.remount.count", std::to_string(count));// addreturn true;
}

获取状态remount状态

java

import android.os.SystemProperties;public static final String PROP_REMOUNT_COUNT = "persist.sys.remount.count";/*** NULL* @return device remount status*/public static boolean isRemounted(){return getRemountCount() >0;}/*** NULL* @return get remount count Since first power up*/public static int getRemountCount(){return SystemProperties.getInt(PROP_ROOT_COUNT,0);}
http://www.15wanjia.com/news/186038.html

相关文章:

  • 企业开发网站用什么技术wordpress考试模板
  • 建网站需要什么条件网站的icp是什么意思
  • 微信如何投放广告seo的方法
  • html的所有代码大全广告优化师怎么入行
  • 分析seo做的不好的网站怎么做淘宝返利网站
  • 塘厦镇住房规划建设局网站培训网站模板免费
  • 红酒网站设计别墅装修公司排名前十强
  • 网站 设计公司 温州wordpress js代码编辑器插件下载地址
  • 淘宝客cms网站建设wordpress粉丝
  • 杭州开发网站的公司哪家好重庆市工程建设信息网官方网站
  • 西宁网站东莞短视频的推广方法
  • 做网站的电脑自带软件是什么免费做代理又不用进货
  • 给我一个用c 做的网站网站正在建设中色
  • 一站式网站建设多少钱静海网站建设制作
  • 门户网站建设公司案例wordpress 内存超限
  • 菜鸟教程网站建设程序员做项目网站
  • 福州企业网站开发wordpress 前端传文件
  • 静态网站如何建设鲜花网站设计论文
  • 成品网站管系统国家企业信息公示网查询全国官网
  • 彩票网站开发 晓风国内做app软件开发最好的公司
  • 网站建设数据库模板西安网站制作开发
  • 门窗网站源码百度seo优化工具
  • 因酷网站建设西安专业网站设计
  • 网站后台管理默认密码江油建设局网站
  • 沈阳网站建设策划方案品牌网站开发价格
  • 做马甲的网站廊坊视频优化效果
  • 搭建企业网站具体过程网站后期维护工作包括哪些
  • 在线网站wordpress 朋友圈
  • 聚合影视网站建设微信网站开发与网站实质区别
  • 企业做淘宝网站需要多少钱福州建设网站