Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Android/art/art/dex2oat/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 2 kB image not shown  

Quelle  sdk_checker.h

  Sprache: C
 

/*
 * Copyright (C) 2020 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.
 */


#ifndef ART_DEX2OAT_SDK_CHECKER_H_
#define ART_DEX2OAT_SDK_CHECKER_H_

#include "art_field.h"
#include "art_method.h"
#include "base/locks.h"
#include "base/macros.h"
#include "dex/dex_file.h"

namespace art HIDDEN {

/**
 * The SdkChecker verifies if a given symbol is present in a given classpath.
 *
 * For convenience and future extensibility the classpath is given as set of
 * dex files, simillar to a regular classpath the APKs use.
 *
 * The symbol (method, field, class) is checked based on its descriptor and not
 * according the any access check semantic.
 *
 * This class is intended to be used during off-device AOT verification when
 * only some predefined symbols should be resolved (e.g. belonging to some public
 * API classpath).
 */

class SdkChecker {
 public:
  // Constructs and SDK Checker from the given public sdk paths. The public_sdk
  // format is the same as the classpath format (e.g. `dex1:dex2:dex3`). The
  // method will attempt to open the dex files and if there are errors it will
  // return a nullptr and set the error_msg appropriately.
  EXPORT static SdkChecker* Create(const std::string& public_sdk, std::string* error_msg);

  // Verify if it should deny access to the given methods.
  // The decision is based on whether or not any of the API dex files declares a method
  // with the same signature.
  //
  // NOTE: This is an expensive check as it searches the dex files for the necessary type
  // and string ids. This is OK because the functionality here is indended to be used
  // only in AOT verification.
  bool ShouldDenyAccess(ArtMethod* art_method) const REQUIRES_SHARED(Locks::mutator_lock_);

  // Similar to ShouldDenyAccess(ArtMethod* art_method).
  bool ShouldDenyAccess(ArtField* art_field) const REQUIRES_SHARED(Locks::mutator_lock_);

  // Similar to ShouldDenyAccess(ArtMethod* art_method).
  bool ShouldDenyAccess(std::string_view type_descriptor) const;

  // Enabled/Disable the checks.
  void SetEnabled(bool enabled) { enabled_ = enabled; }

 private:
  SdkChecker();

  std::vector<std::unique_ptr<const DexFile>> sdk_dex_files_;

  bool enabled_;
};

}  // namespace art

#endif  // ART_DEX2OAT_SDK_CHECKER_H_

Messung V0.5 in Prozent
C=89 H=96 G=92

¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet am  2026-06-29) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.