AppDetails: Remove unnecessary Signature
Mainly since in the future we'll only have the hash of it, so avoid depending on the object.
This commit is contained in:
parent
960b67e950
commit
8b114326f5
@ -32,7 +32,6 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.Signature;
|
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -106,9 +105,7 @@ interface AppDetailsData {
|
|||||||
|
|
||||||
AppDetails.ApkListAdapter getApks();
|
AppDetails.ApkListAdapter getApks();
|
||||||
|
|
||||||
Signature getInstalledSignature();
|
String getInstalledSigHash();
|
||||||
|
|
||||||
String getInstalledSignatureId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -451,7 +448,6 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The signature of the installed version.
|
// The signature of the installed version.
|
||||||
private Signature mInstalledSignature;
|
|
||||||
private String mInstalledSigID;
|
private String mInstalledSigID;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -618,21 +614,18 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
startingIgnoreThis = app.ignoreThisUpdate;
|
startingIgnoreThis = app.ignoreThisUpdate;
|
||||||
|
|
||||||
// Get the signature of the installed package...
|
// Get the signature of the installed package...
|
||||||
mInstalledSignature = null;
|
|
||||||
mInstalledSigID = null;
|
mInstalledSigID = null;
|
||||||
|
|
||||||
if (app.isInstalled()) {
|
if (app.isInstalled()) {
|
||||||
PackageManager pm = getPackageManager();
|
PackageManager pm = getPackageManager();
|
||||||
try {
|
try {
|
||||||
PackageInfo pi = pm.getPackageInfo(app.id, PackageManager.GET_SIGNATURES);
|
PackageInfo pi = pm.getPackageInfo(app.id, PackageManager.GET_SIGNATURES);
|
||||||
mInstalledSignature = pi.signatures[0];
|
Hasher hash = new Hasher("MD5", pi.signatures[0].toCharsString().getBytes());
|
||||||
Hasher hash = new Hasher("MD5", mInstalledSignature.toCharsString().getBytes());
|
|
||||||
mInstalledSigID = hash.getHash();
|
mInstalledSigID = hash.getHash();
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.w(TAG, "Failed to get installed signature");
|
Log.w(TAG, "Failed to get installed signature");
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
Log.w(TAG, "Failed to calculate signature MD5 sum");
|
Log.w(TAG, "Failed to calculate signature MD5 sum");
|
||||||
mInstalledSignature = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1053,12 +1046,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Signature getInstalledSignature() {
|
public String getInstalledSigHash() {
|
||||||
return mInstalledSignature;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInstalledSignatureId() {
|
|
||||||
return mInstalledSigID;
|
return mInstalledSigID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,12 +1093,8 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
return data.getApks();
|
return data.getApks();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Signature getInstalledSignature() {
|
protected String getInstalledSigHash() {
|
||||||
return data.getInstalledSignature();
|
return data.getInstalledSigHash();
|
||||||
}
|
|
||||||
|
|
||||||
protected String getInstalledSignatureId() {
|
|
||||||
return data.getInstalledSignatureId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1418,20 +1402,19 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateViews(View view) {
|
public void updateViews(View view) {
|
||||||
|
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
Log.e(TAG, "AppDetailsSummaryFragment.updateViews(): view == null. Oops.");
|
Log.e(TAG, "AppDetailsSummaryFragment.updateViews(): view == null. Oops.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView signatureView = (TextView) view.findViewById(R.id.signature);
|
TextView signatureView = (TextView) view.findViewById(R.id.signature);
|
||||||
if (prefs.expertMode() && getInstalledSignature() != null) {
|
String sig = getInstalledSigHash();
|
||||||
|
if (prefs.expertMode() && !TextUtils.isEmpty(sig)) {
|
||||||
signatureView.setVisibility(View.VISIBLE);
|
signatureView.setVisibility(View.VISIBLE);
|
||||||
signatureView.setText("Signed: " + getInstalledSignatureId());
|
signatureView.setText("Signed: " + sig);
|
||||||
} else {
|
} else {
|
||||||
signatureView.setVisibility(View.GONE);
|
signatureView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user