How does android get the name of the currently running application

how can I get the name of the actual app program that is currently running?
Environment: sdk version 23J Android studio3.1 oppoA59s
2.Service Code

//Activity
final ActivityManager am = (ActivityManager) getApplicationContext().getSystemService(Activity.ACTIVITY_SERVICE);

new Thread(){
    public void run() {
        while(true){
            try {
                List< ActivityManager.RunningTaskInfo > runningTaskInfo = am.getRunningTasks(1);                            
                ComponentName componentInfo = runningTaskInfo.get(0).topActivity;                           
                Log.i(TAG, componentInfo.getPackageName());
                sleep(200);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };
}.start();

manifest.xml Code

<uses-permission android:name="android.permission.GET_TASKS"></uses-permission>

but the current app name I got when I opened another app seems to be hidden by the android system. All display com.oppo.launcher.

clipboard.png

Mar.03,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d794-2b8e2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d794-2b8e2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?