Skip to content

Commit

Permalink
Add SetProfile Activity for external use
Browse files Browse the repository at this point in the history
  • Loading branch information
Blacky-Toggle committed Aug 2, 2022
1 parent 57c8cb3 commit 9f2136d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
</intent-filter>
</activity>

<activity
android:name=".api.SetProfile"
android:autoRemoveFromRecents="true"
android:excludeFromRecents="true"
android:exported="true"
android:taskAffinity=".api.SetProfile">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

<receiver
android:name=".widget.ProfileWidget"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.saiho.togglelineageprofiles.api;

import android.app.Activity;
import android.os.RemoteException;

import static com.saiho.togglelineageprofiles.Common.setCurrentProfile;

public class SetProfile extends Activity {

public static final String PROFILE_NAME = "com.saiho.togglelineageprofiles.api.profileName";

protected void onStart() {
super.onStart();
try {
performTask();
} catch (RemoteException e) {
e.printStackTrace();
}
}

private void performTask() throws RemoteException {
String profileName = getIntent().getStringExtra( PROFILE_NAME );
setCurrentProfile( getApplicationContext(), profileName );
finish();
}
}

0 comments on commit 9f2136d

Please sign in to comment.