Sobes.tech
Middle

What is the difference between Android 8 and Android 9?

sobes.tech AI

Answer from AI

Android 9 Pie introduced many significant changes compared to Android 8 Oreo. Key differences include:

User Interface and Navigation:

  • New full-screen gesture navigation instead of traditional navigation buttons.
  • Redesigned quick settings and notifications.
  • Adaptive Battery, which uses machine learning to prioritize resources for frequently used apps.
  • Adaptive Brightness, which automatically adjusts screen brightness based on user preferences and ambient conditions.
  • Slices — interactive parts of apps displayed in Google Search and Google Assistant.

Performance and Power Efficiency:

  • Improved management of background app activity.
  • Do Not Disturb with Wind Down feature, which turns the screen gray before sleep.

Privacy and Security:

  • Restricts access to microphone, camera, and sensors when the app is idle.
  • Encrypts backups on Google Drive.
  • Uses a random MAC address by default when connecting to Wi-Fi.

Developer APIs:

  • Multiple Camera API for simultaneous access to streams from multiple physical cameras.
  • AnimatedImageDrawable API for working with animated images.
  • Display Cutout API to support notches (cutouts) on screens.
  • Improvements in neural network processing (Neural Networks API 1.1).
Feature Android 8 Oreo Android 9 Pie
Navigation Buttons (can be gestures) Gestures (can be buttons)
Adaptive Battery No Yes
Adaptive Brightness No Yes
Slices No Yes
API Multiple Camera No Yes
API Display Cutout No Yes
Random MAC address Wi-Fi Optional Default

Example code demonstrating the use of Display Cutout API to detect notches:

// In your activity
import android.view.DisplayCutout;
import android.view.Window;
import android.view.WindowManager;

// ...

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Set flags to support display cutouts
    getWindow().getAttributes().layoutInDisplayCutoutMode =
            WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;

    setContentView(R.layout.activity_main);

    final View decorView = getWindow().getDecorView();
    decorView.post(() -> {
        DisplayCutout displayCutout = decorView.getRootWindowInsets().getDisplayCutout();
        if (displayCutout != null) {
            // You can get a list of Rect objects for each notch
            List<Rect> cutouts = displayCutout.getBoundingRects();
            // Further logic to work with notches
            Log.d("TAG", "Cutouts detected: " + cutouts.size());
        }
    });
}