mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Update test java file to support InlineExpectationsTest
This commit is contained in:
@@ -11,7 +11,7 @@ public class APKInstallation extends Activity {
|
||||
public void installAPK(String path) {
|
||||
// BAD: the path is not checked
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive");
|
||||
intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive"); // $ hasApkInstallation
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class APKInstallation extends Activity {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setType(APK_MIMETYPE);
|
||||
// BAD: the path is not checked
|
||||
intent.setData(Uri.fromFile(new File(path)));
|
||||
intent.setData(Uri.fromFile(new File(path))); // $ hasApkInstallation
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class APKInstallation extends Activity {
|
||||
// BAD: file is from external storage
|
||||
File file = new File(Environment.getExternalStorageDirectory(), path);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(Uri.fromFile(file), APK_MIMETYPE);
|
||||
intent.setDataAndType(Uri.fromFile(file), APK_MIMETYPE); // $ hasApkInstallation
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ public class APKInstallation extends Activity {
|
||||
// BAD: file is from external storage
|
||||
File file = new File(Environment.getExternalStorageDirectory(), path);
|
||||
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
|
||||
intent.setData(Uri.fromFile(file));
|
||||
intent.setData(Uri.fromFile(file)); // $ hasApkInstallation
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void installAPKInstallPackageLiteral(String path) {
|
||||
File file = new File(Environment.getExternalStorageDirectory(), path);
|
||||
Intent intent = new Intent("android.intent.action.INSTALL_PACKAGE");
|
||||
intent.setData(Uri.fromFile(file));
|
||||
intent.setData(Uri.fromFile(file)); // $ hasApkInstallation
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class APKInstallation extends Activity {
|
||||
Intent intent = new Intent(this, OtherActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
// BAD: the file is from unknown source
|
||||
intent.setData(Uri.fromFile(file));
|
||||
intent.setData(Uri.fromFile(file)); // $ hasApkInstallation
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user