Adb connection through wifi

https://developer.android.com/studio/command-line/adb?hl=ko


 Android 11 or higher

1. Enter Developer Options > Wireless Debugging

2. Change to "Disabled" -> "In use"

3. Select device pairing by pairing code

     Check the pop-up

4. PC: adb pair ip:pair_port

     ip:pair_port is set to the information shown in the popup

5. PC: Enter the pairing code that appears in the pop-up at "Enter pairing code:"

6. PC: adb connect ip:adb_port

     Use ip and port displayed on the wireless debugging screen

7. PC: adb logcat


Android 10 or lower (also works on Android 11)

1. Developer Options > USB Debugging

2. Change to "Disabled" -> "In use"

3. Connect the device PC via USB

4. PC: adb tcpip 5555

5. PC: adb connect ip:5555

6. PC: adb logcat

Create Swing CustomLineBorder (apply by specifying top, left, bottom, right)

Overriding border to apply border only to the specified side

package test.swing;

import javax.swing.*;
import javax.swing.border.AbstractBorder;
import java.awt.*;

// Custom Line border
public class MainTest {
    public static void main(String[] args) {
        MainUI mainUI = new MainUI();
        mainUI.setVisible(true);
    }
}

class CustomLineBorder extends AbstractBorder
{
    public static final int TOP = 0x1;
    public static final int LEFT = 0x2;
    public static final int BOTTOM = 0x4;
    public static final int RIGHT = 0x8;
    private Color mColor;
    private int mThickness;
    private int mTarget;

    public CustomLineBorder(Color colour, int thickness, int target)
    {
        mColor = colour;
        mThickness = thickness;
        mTarget = target;
    }

    @Override
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
    {
        if (g != null)
        {
            g.setColor(mColor);
            if ((mTarget & TOP) != 0) {
                for (int i = 0; i < mThickness; i++) {
                    g.drawLine(x, y + i, width, y + i);
                }
            }
            if ((mTarget & LEFT) != 0) {
                for (int i = 0; i < mThickness; i++) {
                    g.drawLine(x + i, y, x + i, height);
                }
            }
            if ((mTarget & BOTTOM) != 0) {
                for (int i = 0; i < mThickness; i++) {
                    g.drawLine(x, height - i - 1, width, height - i - 1);
                }
            }
            if ((mTarget & RIGHT) != 0) {
                for (int i = 0; i < mThickness; i++) {
                    g.drawLine(width - i - 1, y, width - i - 1, height);
                }
            }
        }
    }

    @Override
    public Insets getBorderInsets(Component c)
    {
        return (getBorderInsets(c, new Insets(0, 0, 0, 0)));
    }

    @Override
    public Insets getBorderInsets(Component c, Insets insets)
    {
        insets.top = 0;
        insets.left = 0;
        insets.bottom = 0;
        insets.right = 0;
        if ((mTarget & TOP) != 0) {
            insets.top = mThickness;
        }
        if ((mTarget & LEFT) != 0) {
            insets.left = mThickness;
        }
        if ((mTarget & BOTTOM) != 0) {
            insets.bottom = mThickness;
        }
        if ((mTarget & RIGHT) != 0) {
            insets.right = mThickness;
        }

        return insets;
    }

    @Override
    public boolean isBorderOpaque()
    {
        return true;
    }
}

class MainUI extends JFrame {
    MainUI() {
        setPreferredSize(new Dimension(400, 420));
        
        JPanel pane = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 20));
        pane.setBackground(new Color(0x85, 0x85, 0x85));

        JLabel label = new JLabel("Red, 1, TOP");
        label.setPreferredSize(new Dimension(300, 40));
        label.setOpaque(true);
        label.setBackground(Color.WHITE);
        label.setBorder(new CustomLineBorder(Color.RED, 1, CustomLineBorder.TOP));
        pane.add(label);

        label = new JLabel("Red, 5, LEFT");
        label.setPreferredSize(new Dimension(300, 40));
        label.setOpaque(true);
        label.setBackground(Color.WHITE);
        label.setBorder(new CustomLineBorder(Color.RED, 5, CustomLineBorder.LEFT));
        pane.add(label);

        label = new JLabel("Red, 5, Bottom");
        label.setPreferredSize(new Dimension(300, 40));
        label.setOpaque(true);
        label.setBackground(Color.WHITE);
        label.setBorder(new CustomLineBorder(Color.RED, 5, CustomLineBorder.BOTTOM));
        pane.add(label);

        label = new JLabel("Red, 15, Right");
        label.setPreferredSize(new Dimension(300, 40));
        label.setOpaque(true);
        label.setBackground(Color.WHITE);
        label.setBorder(new CustomLineBorder(Color.RED, 15, CustomLineBorder.RIGHT));
        pane.add(label);

        label = new JLabel("Blue, 5, TOP LEFT");
        label.setPreferredSize(new Dimension(300, 40));
        label.setOpaque(true);
        label.setBackground(Color.WHITE);
        label.setBorder(new CustomLineBorder(Color.BLUE, 5, CustomLineBorder.LEFT | CustomLineBorder.TOP));
        pane.add(label);

        label = new JLabel("Blue, 5, TOP RIGHT BOTTOM");
        label.setPreferredSize(new Dimension(300, 40));
        label.setOpaque(true);
        label.setBackground(Color.WHITE);
        label.setBorder(new CustomLineBorder(Color.BLUE, 5, CustomLineBorder.TOP | CustomLineBorder.RIGHT | CustomLineBorder.BOTTOM));
        pane.add(label);

        add(pane);

        pack();
    }
}

Run


 

 

Howto check android sepolicy status

Show sepolicy by process

1. connect adb to android device

2. adb shell ps -eZ

......                            
u:r:priv_app:s0:c522,c768      u10_a248      29036    825 33799276 202616 0                  0 S com.google.android.googlequicksearchbox:search    
u:r:priv_app:s0:c522,c768      u10_a247      29162    825 15532196 85196 0                   0 S com.google.process.gapps    
u:r:gmscore_app:s0:c522,c768   u10_a247      29170    825 16504752 154944 0                  0 S com.google.android.gms    
u:r:priv_app:s0:c522,c768      u10_a248      29251    825 16446808 150508 0                  0 S com.google.android.googlequicksearchbox:interactor    
u:r:untrusted_app:s0:c1,c257,c512,c768 u0_a257 29267  825 32630088 143932 0                  0 S com.android.chrome:privileged_process2    
u:r:app_zygote:s0:c512,c768    u0_a257       29274    825 16171312 74484 0                   0 S com.android.chrome_zygote    
u:r:untrusted_app:s0:c5,c257,c522,c768 u10_a261 29314 825 15570464 85916 0                   0 S com.google.android.webview:webview_service    
......

Show sepolicy by file

1. connect adb to android device

2. adb shell ls -lZ

......                            
drwxr-xr-x  18 root   system    u:object_r:tmpfs:s0                    380 2019-11-22 01:22 mnt    
drwxr-xr-x   4 root   root      u:object_r:vendor_file:s0             4096 2009-01-01 00:00 odm    
drwxr-xr-x   2 root   root      u:object_r:oemfs:s0                   4096 2009-01-01 00:00 oem    
drwxrwx--x   3 root   system    u:object_r:omr_file:s0                4096 2019-01-06 12:31 omr    
drwxr-xr-x   4 root   root      u:object_r:vendor_file:s0             4096 2009-01-01 00:00 optics    
drwxr-xr-x   7 root   root      u:object_r:system_file:s0             4096 2009-01-01 00:00 prism    
dr-xr-xr-x 846 root   root      u:object_r:proc:s0                       0 1970-01-01 09:00 proc    
drwxr-xr-x   9 root   root      u:object_r:system_file:s0             4096 2009-01-01 00:00 product    
......

 

Values used by crontab

cron is a command provided in Linux to periodically schedule specific tasks. Set up tasks through contab. editor settings When executin...