clean unused methods

This commit is contained in:
REAndroid 2023-03-06 06:49:40 -05:00
parent 01ffe761fe
commit 6235d1f3ad
5 changed files with 5 additions and 72 deletions

View File

@ -28,13 +28,12 @@
import com.reandroid.arsc.util.ResNameMap; import com.reandroid.arsc.util.ResNameMap;
import com.reandroid.arsc.value.Entry; import com.reandroid.arsc.value.Entry;
import com.reandroid.common.Frameworks; import com.reandroid.common.Frameworks;
import com.reandroid.common.ResourceResolver;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
public class EncodeMaterials implements ResourceResolver { public class EncodeMaterials {
private final Set<ResourceIds.Table.Package> packageIdSet = new HashSet<>(); private final Set<ResourceIds.Table.Package> packageIdSet = new HashSet<>();
private PackageBlock currentPackage; private PackageBlock currentPackage;
private final Set<FrameworkTable> frameworkTables = new HashSet<>(); private final Set<FrameworkTable> frameworkTables = new HashSet<>();
@ -304,20 +303,6 @@
return currentPackage.getId(); return currentPackage.getId();
} }
@Override
public int resolveResourceId(String packageName, String type, String name) {
if(!isFrameworkPackageName(packageName)){
return resolveLocalResourceId(type, name);
}
return resolveFrameworkResourceId(packageName, type, name);
}
@Override
public int resolveResourceId(int packageId, String type, String name) {
if(packageId==getCurrentPackageId()){
return resolveLocalResourceId(type, name);
}
return resolveFrameworkResourceId(packageId, type, name);
}
public void logMessage(String msg) { public void logMessage(String msg) {
if(apkLogger!=null){ if(apkLogger!=null){
apkLogger.logMessage(msg); apkLogger.logMessage(msg);

View File

@ -506,7 +506,8 @@ import java.util.regex.Pattern;
if(pkgId==0){ if(pkgId==0){
pkgId=packageOrResourceId; pkgId=packageOrResourceId;
} }
Collection<PackageBlock> allPkg = entryStore.getPackageBlocks((byte) pkgId); pkgId = pkgId & 0xff;
Collection<PackageBlock> allPkg = entryStore.getPackageBlocks(pkgId);
if(allPkg==null){ if(allPkg==null){
return null; return null;
} }

View File

@ -22,12 +22,7 @@ import com.reandroid.arsc.item.TableString;
import java.util.Collection; import java.util.Collection;
public interface EntryStore { public interface EntryStore {
EntryGroup searchEntryGroup(String packageName, String type, String name);
Collection<EntryGroup> getEntryGroups(int resourceId); Collection<EntryGroup> getEntryGroups(int resourceId);
EntryGroup getEntryGroup(int resourceId); EntryGroup getEntryGroup(int resourceId);
Collection<PackageBlock> getPackageBlocks(int packageId);
Collection<PackageBlock> getPackageBlocks(byte packageId);
Collection<TableString> getTableStrings(byte packageId, int stringReference);
} }

View File

@ -1,21 +0,0 @@
/*
* Copyright (C) 2022 github.com/REAndroid
*
* 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.
*/
package com.reandroid.common;
public interface ResourceResolver {
int resolveResourceId(String packageName, String type, String name);
int resolveResourceId(int packageId, String type, String name);
}

View File

@ -75,21 +75,6 @@ public class TableEntryStore implements EntryStore{
return packageBlockSet; return packageBlockSet;
} }
@Override @Override
public EntryGroup searchEntryGroup(String packageName, String type, String name) {
return null;
}
private Set<TableBlock> getTableBlocks(int packageId) {
Set<TableBlock> results=new HashSet<>();
Set<PackageBlock> packageBlockSet = mPackagesMap.get(packageId);
if(packageBlockSet!=null){
for(PackageBlock packageBlock:packageBlockSet){
TableBlock tableBlock=packageBlock.getTableBlock();
results.add(tableBlock);
}
}
return results;
}
@Override
public List<EntryGroup> getEntryGroups(int resourceId) { public List<EntryGroup> getEntryGroups(int resourceId) {
List<EntryGroup> results = searchEntryGroups(resourceId); List<EntryGroup> results = searchEntryGroups(resourceId);
if(results.size()>0){ if(results.size()>0){
@ -106,7 +91,7 @@ public class TableEntryStore implements EntryStore{
return searchEntryGroup(searchIdAlias(resourceId)); return searchEntryGroup(searchIdAlias(resourceId));
} }
@Override @Override
public List<PackageBlock> getPackageBlocks(byte packageId) { public List<PackageBlock> getPackageBlocks(int packageId) {
List<PackageBlock> results=new ArrayList<>(); List<PackageBlock> results=new ArrayList<>();
Set<PackageBlock> packageBlockSet = mPackagesMap.get(0xff & packageId); Set<PackageBlock> packageBlockSet = mPackagesMap.get(0xff & packageId);
if(packageBlockSet!=null){ if(packageBlockSet!=null){
@ -114,18 +99,6 @@ public class TableEntryStore implements EntryStore{
} }
return results; return results;
} }
@Override
public List<TableString> getTableStrings(byte packageId, int stringReference) {
List<TableString> results=new ArrayList<>();
Set<TableBlock> tableBlockSet=getTableBlocks(0xff & packageId);
for(TableBlock tableBlock:tableBlockSet){
TableString tableString=tableBlock.getTableStringPool().get(stringReference);
if(tableString!=null){
results.add(tableString);
}
}
return results;
}
private List<EntryGroup> searchEntryGroups(int resourceId) { private List<EntryGroup> searchEntryGroups(int resourceId) {
if(resourceId==0){ if(resourceId==0){
return new ArrayList<>(); return new ArrayList<>();