blob: 1ea32db1281583704a26b1d738a39e3b5ec9e13f [file] [log] [blame]
Mohamed Heikalc7694032018-11-07 16:49:02 -05001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
felkachang4bdd3ac2022-09-13 10:58:49 +080017#ifndef TOOLS_AAPT2_OPTIMIZE_OBFUSCATOR_H_
18#define TOOLS_AAPT2_OPTIMIZE_OBFUSCATOR_H_
Mohamed Heikalc7694032018-11-07 16:49:02 -050019
20#include <map>
felkachang4bdd3ac2022-09-13 10:58:49 +080021#include <string>
Mohamed Heikalc7694032018-11-07 16:49:02 -050022
23#include "android-base/macros.h"
Mohamed Heikalc7694032018-11-07 16:49:02 -050024#include "process/IResourceTableConsumer.h"
25
26namespace aapt {
27
28class ResourceTable;
29
30// Maps resources in the apk to shortened paths.
felkachang4bdd3ac2022-09-13 10:58:49 +080031class Obfuscator : public IResourceTableConsumer {
Mohamed Heikalc7694032018-11-07 16:49:02 -050032 public:
felkachang4bdd3ac2022-09-13 10:58:49 +080033 explicit Obfuscator(std::map<std::string, std::string>& path_map_out);
Mohamed Heikalc7694032018-11-07 16:49:02 -050034
35 bool Consume(IAaptContext* context, ResourceTable* table) override;
36
37 private:
Mohamed Heikalc7694032018-11-07 16:49:02 -050038 std::map<std::string, std::string>& path_map_;
felkachang4bdd3ac2022-09-13 10:58:49 +080039 DISALLOW_COPY_AND_ASSIGN(Obfuscator);
Mohamed Heikalc7694032018-11-07 16:49:02 -050040};
41
felkachang4bdd3ac2022-09-13 10:58:49 +080042} // namespace aapt
Mohamed Heikalc7694032018-11-07 16:49:02 -050043
felkachang4bdd3ac2022-09-13 10:58:49 +080044#endif // TOOLS_AAPT2_OPTIMIZE_OBFUSCATOR_H_