Skip to content

Commit

Permalink
[core] Remove useless files (LSPosed#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 authored Jun 17, 2021
1 parent 73e27dc commit f410634
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 148 deletions.
59 changes: 0 additions & 59 deletions core/src/main/cpp/main/include/byte_order.h

This file was deleted.

78 changes: 0 additions & 78 deletions core/src/main/cpp/main/include/dl_util.h

This file was deleted.

1 change: 0 additions & 1 deletion core/src/main/cpp/main/src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "jni/art_class_linker.h"
#include "jni/yahfa.h"
#include "jni/resources_hook.h"
#include <dl_util.h>
#include <art/runtime/jni_env_ext.h>
#include "jni/pending_hooks.h"
#include "context.h"
Expand Down
16 changes: 7 additions & 9 deletions core/src/main/cpp/main/src/jni/resources_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include <dex_builder.h>
#include <art/runtime/thread.h>
#include <art/runtime/mirror/class.h>
#include <dl_util.h>
#include <framework/androidfw/resource_types.h>
#include <byte_order.h>
#include <HookMain.h>
#include <elf_util.h>
#include "native_util.h"
Expand Down Expand Up @@ -164,18 +162,18 @@ namespace lspd {
switch (ResXMLParser_next(parser)) {
case android::ResXMLParser::START_TAG:
tag = (android::ResXMLTree_attrExt *) parser->mCurExt;
attrCount = dtohs(tag->attributeCount);
attrCount = tag->attributeCount;
for (int idx = 0; idx < attrCount; idx++) {
auto attr = (android::ResXMLTree_attribute *)
(((const uint8_t *) tag)
+ dtohs(tag->attributeStart)
+ (dtohs(tag->attributeSize) * idx));
+ tag->attributeStart
+ tag->attributeSize * idx);

// find resource IDs for attribute names
int32_t attrNameID = ResXMLParser_getAttributeNameID(parser, idx);
// only replace attribute name IDs for app packages
if (attrNameID >= 0 && (size_t) attrNameID < mTree.mNumResIds &&
dtohl(mResIds[attrNameID]) >= 0x7f000000) {
mResIds[attrNameID] >= 0x7f000000) {
auto attrName = mTree.mStrings.stringAt(attrNameID);
jint attrResID = env->CallStaticIntMethod(classXResources,
methodXResourcesTranslateAttrId,
Expand All @@ -186,14 +184,14 @@ namespace lspd {
if (env->ExceptionCheck())
goto leave;

mResIds[attrNameID] = htodl(attrResID);
mResIds[attrNameID] = attrResID;
}

// find original resource IDs for reference values (app packages only)
if (attr->typedValue.dataType != android::Res_value::TYPE_REFERENCE)
continue;

jint oldValue = dtohl(attr->typedValue.data);
jint oldValue = attr->typedValue.data;
if (oldValue < 0x7f000000)
continue;

Expand All @@ -204,7 +202,7 @@ namespace lspd {
goto leave;

if (newValue != oldValue)
attr->typedValue.data = htodl(newValue);
attr->typedValue.data = newValue;
}
continue;
case android::ResXMLParser::END_DOCUMENT:
Expand Down
1 change: 0 additions & 1 deletion core/src/main/cpp/main/src/native_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <string>
#include <vector>
#include <art/runtime/runtime.h>
#include <dl_util.h>
#include <art/runtime/jni_env_ext.h>
#include <dobby.h>
#include "symbol_cache.h"
Expand Down

0 comments on commit f410634

Please sign in to comment.