From Built-in to URP
General Structure (通用结构)
First of all, add “RenderPipeline” = “UniversalPipeline” to your tags. Next, all URP shaders are written using HLSL embraced by HLSLPROGRAM/ENDHLSL/etc. macros. To avoid headaches, use them as well.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
package com.example.checksu; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import java.io.BufferedReader; import java.io.InputStreamReader; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(checkSuExists()) { Toast.makeText(getApplicationContext(), "检测到su命令", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(),"没有检测到su命令", Toast.LENGTH_SHORT).show(); } } public boolean checkSuExists() { Process process = null; try { process = Runtime.getRuntime().exec(new String[] { "which", "su" }); BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); return in.readLine() != null; } catch (Throwable t) { return false; } finally { if (process != null) process.destroy(); } } } |