DO NOT MERGE: Move wipe cache|data to libinstall

Therefore, libinstall becomes the sole owner to handle the request
from minadbd service.

The change also includes
1. move logging.cpp out of librecovery
2. drop the dependency on common.h
3. now it's more sensible to move the wipe_cache as part of
install_package. move the wipe_cache to the end of the function.

Bug: 130166585
Test: wipe data and cache from menu
Change-Id: I6f356dccdb38015c50acf756bac246f87c30fc1f
(cherry picked from commit 316e971746)
This commit is contained in:
xunchang
2019-04-16 19:26:31 +00:00
committed by Tianjie Xu
parent 95d67323a4
commit 388d253b9c
17 changed files with 303 additions and 224 deletions
+1 -1
View File
@@ -18,4 +18,4 @@
#include <recovery_ui/ui.h>
int apply_from_adb(bool* wipe_cache, RecoveryUI* ui);
int apply_from_adb(RecoveryUI* ui);
@@ -19,4 +19,4 @@
#include "recovery_ui/device.h"
#include "recovery_ui/ui.h"
int ApplyFromSdcard(Device* device, bool* wipe_cache, RecoveryUI* ui);
int ApplyFromSdcard(Device* device, RecoveryUI* ui);
+5 -4
View File
@@ -43,10 +43,11 @@ enum class OtaType {
BRICK,
};
// Installs the given update package. If INSTALL_SUCCESS is returned and *wipe_cache is true on
// exit, caller should wipe the cache partition.
int install_package(const std::string& package, bool* wipe_cache, bool needs_mount, int retry_count,
RecoveryUI* ui);
// Installs the given update package. This function should also wipe the cache partition after a
// successful installation if |should_wipe_cache| is true or an updater command asks to wipe the
// cache.
int install_package(const std::string& package, bool should_wipe_cache, bool needs_mount,
int retry_count, RecoveryUI* ui);
// Verifies the package by ota keys. Returns true if the package is verified successfully,
// otherwise returns false.
+32
View File
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2019 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.
*/
#pragma once
#include <functional>
#include "recovery_ui/device.h"
#include "recovery_ui/ui.h"
struct selabel_handle;
void SetWipeDataSehandle(selabel_handle* handle);
// Returns true on success.
bool WipeCache(RecoveryUI* ui, const std::function<bool()>& confirm);
// Returns true on success.
bool WipeData(Device* device, bool convert_fbe);