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

Commit 2e2bd22c authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/23918399',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/23918399', 'googleplex-android-review.googlesource.com/24405959', 'googleplex-android-review.googlesource.com/23987679', 'googleplex-android-review.googlesource.com/23988011', 'googleplex-android-review.googlesource.com/24029253', 'googleplex-android-review.googlesource.com/24005105', 'googleplex-android-review.googlesource.com/24575247', 'googleplex-android-review.googlesource.com/24046929', 'googleplex-android-review.googlesource.com/24339445', 'googleplex-android-review.googlesource.com/24762427', 'googleplex-android-review.googlesource.com/23623415', 'googleplex-android-review.googlesource.com/24606761', 'googleplex-android-review.googlesource.com/24182288', 'googleplex-android-review.googlesource.com/24790879', 'googleplex-android-review.googlesource.com/24058898', 'googleplex-android-review.googlesource.com/24419913', 'googleplex-android-review.googlesource.com/24555974', 'googleplex-android-review.googlesource.com/24945646', 'googleplex-android-review.googlesource.com/24998046'] into security-aosp-udc-release.

Change-Id: Ied6ee6a70346e8ab95b3057a0067f9a18c26c8f1
parents 05157e53 9b68987d
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ Result<Unit> Lookup(const std::vector<std::string>& args) {
    return Error("failed to parse config");
  }

  std::vector<std::unique_ptr<const ApkAssets>> apk_assets;
  std::vector<AssetManager2::ApkAssetsPtr> apk_assets;
  std::string target_path;
  std::string target_package_name;
  for (size_t i = 0; i < idmap_paths.size(); i++) {
@@ -217,13 +217,9 @@ Result<Unit> Lookup(const std::vector<std::string>& args) {
    apk_assets.push_back(std::move(overlay_apk));
  }

  // AssetManager2::SetApkAssets requires raw ApkAssets pointers, not unique_ptrs
  std::vector<const ApkAssets*> raw_pointer_apk_assets;
  std::transform(apk_assets.cbegin(), apk_assets.cend(), std::back_inserter(raw_pointer_apk_assets),
                 [](const auto& p) -> const ApkAssets* { return p.get(); });
  AssetManager2 am;
  am.SetApkAssets(raw_pointer_apk_assets);
  am.SetConfiguration(config);
  {
    // Make sure |apk_assets| vector outlives the asset manager as it doesn't own the assets.
    AssetManager2 am(apk_assets, config);

    const Result<ResourceId> resid = ParseResReference(am, resid_str, target_package_name);
    if (!resid) {
@@ -235,6 +231,7 @@ Result<Unit> Lookup(const std::vector<std::string>& args) {
      return Error(value.GetError(), "resource 0x%08x not found", *resid);
    }
    std::cout << *value << std::endl;
  }

  return Unit{};
}
+2 −2
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ OverlayData CreateResourceMappingLegacy(const AssetManager2* overlay_am,
}

struct ResState {
  std::unique_ptr<ApkAssets> apk_assets;
  AssetManager2::ApkAssetsPtr apk_assets;
  const LoadedArsc* arsc;
  const LoadedPackage* package;
  std::unique_ptr<AssetManager2> am;
@@ -284,7 +284,7 @@ struct ResState {
    }

    state.am = std::make_unique<AssetManager2>();
    if (!state.am->SetApkAssets({state.apk_assets.get()})) {
    if (!state.am->SetApkAssets({state.apk_assets})) {
      return Error("failed to create asset manager");
    }

+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class ResourceUtilsTests : public Idmap2Tests {
    apk_assets_ = ApkAssets::Load(GetTargetApkPath());
    ASSERT_THAT(apk_assets_, NotNull());

    am_.SetApkAssets({apk_assets_.get()});
    am_.SetApkAssets({apk_assets_});
  }

  const AssetManager2& GetAssetManager() {
@@ -47,7 +47,7 @@ class ResourceUtilsTests : public Idmap2Tests {

 private:
  AssetManager2 am_;
  std::unique_ptr<const ApkAssets> apk_assets_;
  AssetManager2::ApkAssetsPtr apk_assets_;
};

TEST_F(ResourceUtilsTests, ResToTypeEntryName) {
+12 −8
Original line number Diff line number Diff line
@@ -502,9 +502,13 @@ status_t IncidentService::onTransact(uint32_t code, const Parcel& data, Parcel*

    switch (code) {
        case SHELL_COMMAND_TRANSACTION: {
            int in = data.readFileDescriptor();
            int out = data.readFileDescriptor();
            int err = data.readFileDescriptor();
            unique_fd in, out, err;
            if (status_t status = data.readUniqueFileDescriptor(&in); status != OK) return status;

            if (status_t status = data.readUniqueFileDescriptor(&out); status != OK) return status;

            if (status_t status = data.readUniqueFileDescriptor(&err); status != OK) return status;

            int argc = data.readInt32();
            Vector<String8> args;
            for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
@@ -514,15 +518,15 @@ status_t IncidentService::onTransact(uint32_t code, const Parcel& data, Parcel*
            sp<IResultReceiver> resultReceiver =
                    IResultReceiver::asInterface(data.readStrongBinder());

            FILE* fin = fdopen(in, "r");
            FILE* fout = fdopen(out, "w");
            FILE* ferr = fdopen(err, "w");
            FILE* fin = fdopen(in.release(), "r");
            FILE* fout = fdopen(out.release(), "w");
            FILE* ferr = fdopen(err.release(), "w");

            if (fin == NULL || fout == NULL || ferr == NULL) {
                resultReceiver->send(NO_MEMORY);
            } else {
                err = command(fin, fout, ferr, args);
                resultReceiver->send(err);
                status_t result = command(fin, fout, ferr, args);
                resultReceiver->send(result);
            }

            if (fin != NULL) {
+1 −0
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ interface IActivityTaskManager {
     *              {@link android.view.WindowManagerPolicyConstants#KEYGUARD_GOING_AWAY_FLAG_TO_SHADE}
     *              etc.
     */
     @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.CONTROL_KEYGUARD)")
    void keyguardGoingAway(int flags);

    void suppressResizeConfigChanges(boolean suppress);
Loading