Skip to content

Target android14 #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android {
defaultConfig {
applicationId "com.samsung.microbit"
minSdkVersion 21
targetSdk 33
targetSdk 34
// When target SDK version is 30+,
// requestLegacyExternalStorage will continue to work for 29 Android 10
}
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30"/>
Expand Down Expand Up @@ -167,7 +168,9 @@

<service
android:name=".service.DfuService"
android:enabled="true"/>
android:foregroundServiceType="connectedDevice"
android:enabled="true"
android:exported="false"/>

<service
android:name=".service.PluginService"
Expand All @@ -189,7 +192,7 @@
android:name=".service.PartialFlashingService"
android:enabled="true"
android:launchMode="singleInstance"
/>
android:exported="false"/>

<activity
android:name=".ui.activity.SplashScreenActivity"
Expand Down
35 changes: 33 additions & 2 deletions app/src/main/java/com/samsung/microbit/MBApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import android.app.Application;
import android.graphics.Typeface;
import android.os.Build;
import android.os.StrictMode;
import android.os.strictmode.Violation;
import android.util.Log;

import androidx.annotation.NonNull;
Expand All @@ -13,6 +16,8 @@

import com.samsung.microbit.MBAppState;

import java.util.concurrent.Executors;

/**
* Represents a custom class of the app.
* Provides some resources that use along app modules,
Expand All @@ -39,6 +44,30 @@ public void logi(String message) {

@Override
public void onCreate() {
// if (DEBUG) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
// .detectAll()
// .permitDiskReads()
// .penaltyLog()
// .penaltyListener(Executors.newSingleThreadExecutor(), new StrictMode.OnThreadViolationListener() {
// @Override
// public void onThreadViolation(Violation v) {
// }
// })
// .build());
//
// StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
// .detectAll()
// .penaltyLog()
// .penaltyListener(Executors.newSingleThreadExecutor(), new StrictMode.OnVmViolationListener() {
// @Override
// public void onVmViolation(Violation v) {
// }
// })
// .build());
// }
// }
super.onCreate();
app = this;
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
Expand Down Expand Up @@ -96,16 +125,18 @@ public void onStart(@NonNull LifecycleOwner owner) {
MBApp.getAppState().eventPairForeground();
}

//onPause & onResume occur when pairing confirmation dialogue shows

@Override
public void onResume(@NonNull LifecycleOwner owner) {
logi("onResume");
MBApp.getAppState().eventPairForeground();
//MBApp.getAppState().eventPairForeground();
}

@Override
public void onPause(@NonNull LifecycleOwner owner) {
logi("onPause");
MBApp.getAppState().eventPairBackground();
//MBApp.getAppState().eventPairBackground();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2337,6 +2337,8 @@ public void onClick(View v) {
final int errorType = intent.getIntExtra(DfuBaseService.EXTRA_ERROR_TYPE, 0);
String error_message = "";

PopUp.hide();

switch (errorType) {
case DfuBaseService.ERROR_TYPE_COMMUNICATION_STATE:
if ( errorCode == 0x0085) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public View getView(int position, View convertView, ViewGroup parent) {

Project project = mProjects.get(position);
if(convertView == null) {
LayoutInflater inflater = LayoutInflater.from(MBApp.getApp());
LayoutInflater inflater = LayoutInflater.from( mProjectActivity);
convertView = inflater.inflate(R.layout.project_items, null);
}

Expand Down