Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16023526 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5582435 from ed7e8876 to qt-qpr1-release

Change-Id: Idb7ff49634c3033f8f7f03419affde15b0ae0791
parents 0ec6dbeb ed7e8876
Loading
Loading
Loading
Loading
+59 −39
Original line number Diff line number Diff line
@@ -569,11 +569,38 @@ binder::Status InstalldNativeService::clearAppData(const std::unique_ptr<std::st
                remove_path_xattr(path, kXattrInodeCodeCache);
            }
        }
    }
    if (flags & FLAG_STORAGE_DE) {
        std::string suffix = "";
        bool only_cache = false;
        if (flags & FLAG_CLEAR_CACHE_ONLY) {
            suffix = CACHE_DIR_POSTFIX;
            only_cache = true;
        } else if (flags & FLAG_CLEAR_CODE_CACHE_ONLY) {
            suffix = CODE_CACHE_DIR_POSTFIX;
            only_cache = true;
        }

        auto extPath = findDataMediaPath(uuid, userId);
        auto path = create_data_user_de_package_path(uuid_, userId, pkgname) + suffix;
        if (access(path.c_str(), F_OK) == 0) {
            if (delete_dir_contents(path) != 0) {
                res = error("Failed to delete contents of " + path);
            }
        }
    }
    if (flags & FLAG_STORAGE_EXTERNAL) {
        std::lock_guard<std::recursive_mutex> lock(mMountsLock);
        for (const auto& n : mStorageMounts) {
            auto extPath = n.second;
            if (n.first.compare(0, 14, "/mnt/media_rw/") != 0) {
                extPath += StringPrintf("/%d", userId);
            } else if (userId != 0) {
                // TODO: support devices mounted under secondary users
                continue;
            }
            if (flags & FLAG_CLEAR_CACHE_ONLY) {
                // Clear only cached data from shared storage
            path = StringPrintf("%s/Android/data/%s/cache", extPath.c_str(), pkgname);
                auto path = StringPrintf("%s/Android/data/%s/cache", extPath.c_str(), pkgname);
                if (delete_dir_contents(path, true) != 0) {
                    res = error("Failed to delete contents of " + path);
                }
@@ -581,7 +608,7 @@ binder::Status InstalldNativeService::clearAppData(const std::unique_ptr<std::st
                // No code cache on shared storage
            } else {
                // Clear everything on shared storage
            path = StringPrintf("%s/Android/data/%s", extPath.c_str(), pkgname);
                auto path = StringPrintf("%s/Android/data/%s", extPath.c_str(), pkgname);
                if (delete_dir_contents(path, true) != 0) {
                    res = error("Failed to delete contents of " + path);
                }
@@ -595,23 +622,6 @@ binder::Status InstalldNativeService::clearAppData(const std::unique_ptr<std::st
                }
            }
        }
    if (flags & FLAG_STORAGE_DE) {
        std::string suffix = "";
        bool only_cache = false;
        if (flags & FLAG_CLEAR_CACHE_ONLY) {
            suffix = CACHE_DIR_POSTFIX;
            only_cache = true;
        } else if (flags & FLAG_CLEAR_CODE_CACHE_ONLY) {
            suffix = CODE_CACHE_DIR_POSTFIX;
            only_cache = true;
        }

        auto path = create_data_user_de_package_path(uuid_, userId, pkgname) + suffix;
        if (access(path.c_str(), F_OK) == 0) {
            if (delete_dir_contents(path) != 0) {
                res = error("Failed to delete contents of " + path);
            }
        }
    }
    return res;
}
@@ -662,20 +672,6 @@ binder::Status InstalldNativeService::destroyAppData(const std::unique_ptr<std::
        if (delete_dir_contents_and_dir(path) != 0) {
            res = error("Failed to delete " + path);
        }

        auto extPath = findDataMediaPath(uuid, userId);
        path = StringPrintf("%s/Android/data/%s", extPath.c_str(), pkgname);
        if (delete_dir_contents_and_dir(path, true) != 0) {
            res = error("Failed to delete " + path);
        }
        path = StringPrintf("%s/Android/media/%s", extPath.c_str(), pkgname);
        if (delete_dir_contents_and_dir(path, true) != 0) {
            res = error("Failed to delete " + path);
        }
        path = StringPrintf("%s/Android/obb/%s", extPath.c_str(), pkgname);
        if (delete_dir_contents_and_dir(path, true) != 0) {
            res = error("Failed to delete " + path);
        }
    }
    if (flags & FLAG_STORAGE_DE) {
        auto path = create_data_user_de_package_path(uuid_, userId, pkgname);
@@ -688,6 +684,30 @@ binder::Status InstalldNativeService::destroyAppData(const std::unique_ptr<std::
        // Verify if it's ok to do that.
        destroy_app_reference_profile(packageName);
    }
    if (flags & FLAG_STORAGE_EXTERNAL) {
        std::lock_guard<std::recursive_mutex> lock(mMountsLock);
        for (const auto& n : mStorageMounts) {
            auto extPath = n.second;
            if (n.first.compare(0, 14, "/mnt/media_rw/") != 0) {
                extPath += StringPrintf("/%d", userId);
            } else if (userId != 0) {
                // TODO: support devices mounted under secondary users
                continue;
            }
            auto path = StringPrintf("%s/Android/data/%s", extPath.c_str(), pkgname);
            if (delete_dir_contents_and_dir(path, true) != 0) {
                res = error("Failed to delete contents of " + path);
            }
            path = StringPrintf("%s/Android/media/%s", extPath.c_str(), pkgname);
            if (delete_dir_contents_and_dir(path, true) != 0) {
                res = error("Failed to delete contents of " + path);
            }
            path = StringPrintf("%s/Android/obb/%s", extPath.c_str(), pkgname);
            if (delete_dir_contents_and_dir(path, true) != 0) {
                res = error("Failed to delete contents of " + path);
            }
        }
    }
    return res;
}

+1 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ interface IInstalld {

    const int FLAG_STORAGE_DE = 0x1;
    const int FLAG_STORAGE_CE = 0x2;
    const int FLAG_STORAGE_EXTERNAL = 0x4;

    const int FLAG_CLEAR_CACHE_ONLY = 0x10;
    const int FLAG_CLEAR_CODE_CACHE_ONLY = 0x20;
+31 −0
Original line number Diff line number Diff line
@@ -955,6 +955,27 @@ public:
        }
        return NO_ERROR;
    }

    virtual status_t notifyPowerHint(int32_t hintId) {
        Parcel data, reply;
        status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (error != NO_ERROR) {
            ALOGE("notifyPowerHint: failed to write interface token: %d", error);
            return error;
        }
        error = data.writeInt32(hintId);
        if (error != NO_ERROR) {
            ALOGE("notifyPowerHint: failed to write hintId: %d", error);
            return error;
        }
        error = remote()->transact(BnSurfaceComposer::NOTIFY_POWER_HINT, data, &reply,
                                   IBinder::FLAG_ONEWAY);
        if (error != NO_ERROR) {
            ALOGE("notifyPowerHint: failed to transact: %d", error);
            return error;
        }
        return NO_ERROR;
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -1556,6 +1577,16 @@ status_t BnSurfaceComposer::onTransact(
            }
            return setDisplayBrightness(displayToken, brightness);
        }
        case NOTIFY_POWER_HINT: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            int32_t hintId;
            status_t error = data.readInt32(&hintId);
            if (error != NO_ERROR) {
                ALOGE("notifyPowerHint: failed to read hintId: %d", error);
                return error;
            }
            return notifyPowerHint(hintId);
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+4 −0
Original line number Diff line number Diff line
@@ -1543,6 +1543,10 @@ status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayT
    return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness);
}

status_t SurfaceComposerClient::notifyPowerHint(int32_t hintId) {
    return ComposerService::getComposerService()->notifyPowerHint(hintId);
}

// ----------------------------------------------------------------------------

status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace,
+11 −0
Original line number Diff line number Diff line
@@ -425,6 +425,16 @@ public:
     */
    virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken,
                                          float brightness) const = 0;

    /*
     * Sends a power hint to the composer. This function is asynchronous.
     *
     * hintId
     *      hint id according to android::hardware::power::V1_0::PowerHint
     *
     * Returns NO_ERROR upon success.
     */
    virtual status_t notifyPowerHint(int32_t hintId) = 0;
};

// ----------------------------------------------------------------------------
@@ -477,6 +487,7 @@ public:
        GET_DISPLAY_BRIGHTNESS_SUPPORT,
        SET_DISPLAY_BRIGHTNESS,
        CAPTURE_SCREEN_BY_ID,
        NOTIFY_POWER_HINT,
        // Always append new enum to the end.
    };

Loading