Skip to content

Commit

Permalink
Inital work on refactoring neaby into a service. (#48)
Browse files Browse the repository at this point in the history
* Inital work on refactoring neaby into a service.

* Adding logging messages for android for nearby as callbacks to the foreground service

* Finally getting notifications to show

* Removing fakeinputlib jar from git

* Adapting the old gui for the nearby connection

* latest changes

* Moar

* Working android nearby with management inside a service on the app side, as well as correct activity switches

* Adding tests for nearbyservice and removing old nearby activities

* Fix formatting

* Change name num to default empty string
  • Loading branch information
xiamaz authored and lbb committed Dec 19, 2018
1 parent a1f344e commit 6cfe768
Show file tree
Hide file tree
Showing 18 changed files with 1,154 additions and 878 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/captures
.externalNativeBuild
/fakeinput_dist
app/src/main/res/raw/flyinn_fakeinputlib.jar
/app/src/main/res/raw/fakeinputlib.jar
BuildInfo.java
app/lint-report.html
server/lint-report.html
server/lint-report.html
17 changes: 6 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
android:required="true" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<application
Expand All @@ -51,22 +52,16 @@
android:label="@string/title_activity_build_info"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".ShowCodeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service android:name=".summoner.ADBService" />

<service android:name=".nearbyservice.NearbyService" android:enabled="true" android:exported="true"/>
<activity android:name=".ConnectionSetupActivity" />
<activity android:name=".NearbyConnectionActivity" />
<activity android:name=".ShowCodeConnAuth">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ClientConnAuthActivity"
android:label="@string/title_activity_client_conn_auth">
</activity>
</application>

Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/amos/flyinn/ClientConnAuthActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ public void onRequestPermissionsResult(

/**
* Returns the name of this client, which is set in onCreate().
*
* @return The name of the client.
*/
protected abstract String generateName();
}
19 changes: 0 additions & 19 deletions app/src/main/java/com/amos/flyinn/ConnectionSetupActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,6 @@ public void onClick(View view) {
switchToHomeScreen();
}
});


String addr;
//Preparing and initializing the ADB service to listen for incoming connections.
try {
WifiConnectorSingleton wifiConnector = WifiConnectorSingleton.getInstance();
WifiStateMachine stateMachine = wifiConnector.getWifiReceiverP2P();
Log.d("IP", stateMachine.getHostAddr());
while (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
}
adbDaemon = createADBService(stateMachine.getHostAddr());
} catch (Exception e) {
e.printStackTrace();
}

//Init components for WebRTC and ask permissions for Screen capture functionalities.
this.initViewsWebRTC();
this.initScreenCapturePermissions();
}

/**
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/com/amos/flyinn/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ private void initViewsWebRTC() {
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.search_connections:
// intent = new Intent(this,WifiP2PActivity.class);
intent = new Intent(this, NearbyConnectionActivity.class);
break;
case R.id.adb_activity:
intent = new Intent(this, ADBActivity.class);
break;
Expand Down
Loading

0 comments on commit 6cfe768

Please sign in to comment.