[Android Q&A, Help & Troubleshooting] zwave:
Hi lioce, thanks for your suggestion.

There are multiple calls to package manager but seems that only 1 class is related to signatures, probably I have to follow statically how those methods are used?

Do you see something interesting about some blocking mechanism inside the following class?

I see that there is a call using value 64 which is "GET_SIGNATURES" constant of PackageManager here:

List<byte[]> list1 = a((paramPackageManager.getPackageInfo(providerInfo.packageName, 64)).signatures);

package a;

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.content.pm.Signature;
import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.CancellationSignal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class z9 {
public static final Comparator<byte[]> a = new a();

public static List<byte[]> a(Signature[] paramArrayOfSignature) {
ArrayList<byte[]> arrayList = new ArrayList();
for (int i = 0; i < paramArrayOfSignature.length; i++)
arrayList.add(paramArrayOfSignature[i].toByteArray());
return (List<byte[]>)arrayList;
}

public static boolean b(List<byte[]> paramList1, List<byte[]> paramList2) {
if (paramList1.size() != paramList2.size())
return false;
for (int i = 0; i < paramList1.size(); i++) {
if (!Arrays.equals(paramList1.get(i), paramList2.get(i)))
return false;
}
return true;
}

public static List<List<byte[]>> c(ba paramba, Resources paramResources) {
return (paramba.b() != null) ? paramba.b() : da.c(paramResources, paramba.c());
}

public static ea.a d(Context paramContext, ba paramba, CancellationSignal paramCancellationSignal) {
ProviderInfo providerInfo = e(paramContext.getPackageManager(), paramba, paramContext.getResources());
return (providerInfo == null) ? ea.a.a(1, null) : ea.a.a(0, f(paramContext, paramba, providerInfo.authority, paramCancellationSignal));
}

public static ProviderInfo e(PackageManager paramPackageManager, ba paramba, Resources paramResources) {
String str = paramba.e();
int i = 0;
ProviderInfo providerInfo = paramPackageManager.resolveContentProvider(str, 0);
if (providerInfo != null) {
List<List<byte[]>> list;
if (providerInfo.packageName.equals(paramba.f())) {
List<byte[]> list1 = a((paramPackageManager.getPackageInfo(providerInfo.packageName, 64)).signatures);
Collections.sort((List)list1, (Comparator)a);
list = c(paramba, paramResources);
while (i < list.size()) {
ArrayList<byte> arrayList = new ArrayList(list.get(i));
Collections.sort(arrayList, (Comparator)a);
if (b(list1, (List)arrayList))
return providerInfo;
i++;
}
return null;
}
StringBuilder stringBuilder1 = new StringBuilder();
stringBuilder1.append("Found content provider ");
stringBuilder1.append(str);
stringBuilder1.append(", but package was not ");
stringBuilder1.append(list.f());
throw new PackageManager.NameNotFoundException(stringBuilder1.toString());
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("No package found for authority: ");
stringBuilder.append(str);
PackageManager.NameNotFoundException nameNotFoundException = new PackageManager.NameNotFoundException(stringBuilder.toString());
throw nameNotFoundException;
}

public static ea.b[] f(Context paramContext, ba paramba, String paramString, CancellationSignal paramCancellationSignal) {
ArrayList<ea.b> arrayList1;
ArrayList<ea.b> arrayList2 = new ArrayList();
Uri uri1 = (new Uri.Builder()).scheme("content").authority(paramString).build();
Uri uri2 = (new Uri.Builder()).scheme("content").authority(paramString).appendPath("file").build();
paramString = null;
try {
Cursor cursor;
String[] arrayOfString = new String[7];
arrayOfString[0] = "_id";
arrayOfString[1] = "file_id";
arrayOfString[2] = "font_ttc_index";
arrayOfString[3] = "font_variation_settings";
arrayOfString[4] = "font_weight";
arrayOfString[5] = "font_italic";
arrayOfString[6] = "result_code";
if (Build.VERSION.SDK_INT > 16) {
cursor = paramContext.getContentResolver().query(uri1, arrayOfString, "query = ?", new String[] { paramba.g() }, null, paramCancellationSignal);
} else {
cursor = cursor.getContentResolver().query(uri1, arrayOfString, "query = ?", new String[] { paramba.g() }, null);
}
ArrayList<ea.b> arrayList = arrayList2;
return arrayList.<ea.b>toArray(new ea.b[0]);
} finally {
ArrayList<ea.b> arrayList = arrayList1;
if (arrayList != null)
arrayList.close();
}
}

public class a implements Comparator<byte[]> {
public int a(byte[] param1ArrayOfbyte1, byte[] param1ArrayOfbyte2) {
if (param1ArrayOfbyte1.length != param1ArrayOfbyte2.length) {
int j = param1ArrayOfbyte1.length;
int k = param1ArrayOfbyte2.length;
return j - k;
}
for (int i = 0; i < param1ArrayOfbyte1.length; i++) {
if (param1ArrayOfbyte1[i] != param1ArrayOfbyte2[i]) {
byte b1 = param1ArrayOfbyte1[i];
byte b2 = param1ArrayOfbyte2[i];
i = b1;
b1 = b2;
return i - b1;
}
}
return 0;
}
}
}

UPDATE:

With some breakpoint on it, waiting for debugger, I noticed that it not break on that class... well probably is not the right way.

I'm in this scenario in which I don't know if there is a repacking problem or an anti-tamper protection.

Just another thing, I have a little bit lower size of the repacked apk than the original. There could be a correlation?

View attachment 6046006