Skip to content

Commit

Permalink
Play ストア公開用に最適化
Browse files Browse the repository at this point in the history
  • Loading branch information
s1204IT committed Feb 7, 2024
1 parent 3cb8ad4 commit ce565fa
Show file tree
Hide file tree
Showing 23 changed files with 268 additions and 129 deletions.
72 changes: 61 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ on:
- '*.gradle'
- '*.properties'
workflow_dispatch:
inputs:
release:
description: 'Release'
type: boolean
required: true
default: false

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
steps:

- name: Checkout
Expand All @@ -23,34 +31,76 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
java-version: '17'

- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches/
~/.gradle/wrapper/
key: ${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

- name: Set environments
run: |
{
echo "version=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "commit=$(echo ${{ github.sha }} | cut -c-7)"
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})"
} >> $GITHUB_ENV
- name: Check tag exists
uses: mukunku/tag-exists-action@v1.5.0
if: github.event.inputs.release == 'true'
id: check-tag
with:
tag: "${{ env.version }}"

- name: Release check
if: github.event.inputs.release == 'true'
run: |
if [[ "${{ secrets.STORE_FILE }}" == "" ]]; then
echo -e "\nERROR!\nリリースするには、 署名鍵を設定する必要があります。\n"
echo "STORE_FILE: JKS形式の署名鍵をBase64でエンコードした文字列"
echo "STORE_PASSWORD: キーストアのパスワード"
echo "KEY_ALIAS: 署名のエイリアス"
echo "KEY_PASSWORD: 署名のパスワード"
echo ""
exit 1
fi
if [[ "${{ steps.check-tag.outputs.exists }}" == "true" ]]; then
echo -e "\nERROR!\n既に同じタグが存在します。\n"
echo "build.gradle の versionName を変更してください"
echo ""
exit 1
fi
- name: Build with Gradle
run: |
if [[ -n "${{ secrets.STORE_FILE }}" ]] && [[ -n "${{ secrets.STORE_PASSWORD }}" ]] && [[ -n "${{ secrets.KEY_ALIAS }}" ]] && [[ -n "${{ secrets.KEY_PASSWORD }}" ]]; then
if [[ "${{ inputs.release }}" == "true" ]]; then
echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks
export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}"
export KEY_ALIAS="${{ secrets.KEY_ALIAS }}"
export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}"
./gradlew assembleRelease
./gradlew aR --no-daemon
cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.version }}.apk
else
./gradlew assembleDebug
./gradlew asD --no-daemon
cp -f app/build/outputs/apk/debug/app-debug.apk ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.apk
fi
{
echo "version=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "commit=$(echo ${{ github.sha }} | cut -c-7)"
} >> $GITHUB_ENV
- name: Upload APK
uses: actions/upload-artifact@v4
if: github.event.inputs.release != 'true'
with:
name: ${{ env.repo }}(${{ env.version }}@${{ env.commit }})
path: ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.apk

- name: Release
uses: softprops/action-gh-release@v1
if: github.event.inputs.release == 'true'
with:
name: GalaxyCamSnd(${{ env.version }}@${{ env.commit }})
path: app/build/outputs/apk/**/app-*.apk
tag_name: ${{ env.version }}
draft: true
prerelease: false
files: ${{ env.repo }}-${{ env.version }}.apk
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
# Gradle Build
/app/build/
# Android Studio Signing APK
/app/release/
/app/debug/
/app/release/
# VSCode
/.vscode/
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
Galaxy CamSnd Disabling shutter sound.
Copyright (C) 2023 Syuugo

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

<program> Copyright (C) <year> <name of author>
Galaxy CamSnd Copyright (C) 2023 Syuugo
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
22 changes: 22 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# プライバシーポリシー

<!--
ChatGPT 3.5 より生成
-->

このアプリは利用者の個人情報を一切収集いたしません。プライバシーとデータの保護に関して取り決めが不要です。


1. **データ収集の明示的な許可**:
当アプリは位置情報、個人識別情報、またはその他の個人に関するデータを収集いたしません。したがって、データ収集に関する許可の求めもございません。

2. **外部サービスとの連携**:
当アプリは外部サービスとの連携により、利用者データを取得することはありません。

3. **データの保存と保管**:
当アプリは利用者データを保存または保管することはありません。データが一切サーバーに送信されないため、安全性が確保されています。

4. **セキュリティ**:
利用者のプライバシーとセキュリティを重視し、当アプリは利用者データの収集や蓄積を行わないため、セキュリティ上の懸念は発生しません。

何かご不明点や質問がございましたら、[**Issues**](https://github.com/s1204IT/GalaxyCamSnd/issues)からお問い合わせください。
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## インストール方法
1. [**ここ**](https://github.com/s1204IT/GalaxyCamSnd/releases/latest/download/GalaxyCamSnd.apk)からアプリファイル(APK)をダウンロードする
1. [**ここ**](https://github.com/s1204IT/GalaxyCamSnd/releases/latest/)からアプリファイル(APK)をダウンロードする
2. ダウンロード後、「**開く**」を押す
> [!TIP]
> 「セキュリティ上の理由から...」と表示された場合は、
Expand Down
Binary file added app/android.jks
Binary file not shown.
29 changes: 22 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ plugins {
}

android {
compileSdk 33
buildToolsVersion "30.0.3"
namespace 'me.s1204.galaxycamsnd'
compileSdk 34

defaultConfig {
applicationId 'me.s1204.galaxycamsnd'
minSdk 28
//noinspection ExpiredTargetSdkVersion
targetSdk 22
versionCode 13
versionName "1.4.1"
versionCode 14
versionName "1.4.2"
}

signingConfigs {
android {
storeFile file('android.jks')
storePassword 'android'
keyAlias 'android'
keyPassword 'android'
}
release {
storeFile file('release.jks')
storePassword System.getenv('STORE_PASSWORD')
Expand All @@ -25,16 +31,25 @@ android {

buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled true
shrinkResources true
multiDexEnabled false
proguardFiles += 'proguard-rules.pro'
signingConfig signingConfigs.android
}
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
multiDexEnabled false
proguardFiles += 'proguard-rules.pro'
if (file('release.jks').exists()) {
signingConfig signingConfigs.release
}
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
3 changes: 3 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-ignorewarnings
-keepattributes LineNumberTable,SourceFile
-renamesourcefileattribute SourceFile
28 changes: 9 additions & 19 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.s1204.galaxycamsnd">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
Expand All @@ -9,7 +8,8 @@
android:allowBackup="true"
android:appCategory="productivity"
android:icon="@drawable/ic_launcher"
android:label="Galaxy CamSnd">
android:label="@string/app_name"
android:theme="@android:style/Theme.NoDisplay">

<activity
android:name=".CameraActivity"
Expand All @@ -24,8 +24,12 @@

<activity
android:name=".DisableActivity"
android:clearTaskOnLaunch="true"
android:excludeFromRecents="true"
android:exported="true"
android:label="@string/enable">
android:label="@string/enable_shutter_sound"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.Material.Dialog.Alert">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
</intent-filter>
Expand All @@ -34,23 +38,9 @@
<receiver
android:name=".BootCompletedReceiver"
android:exported="true">
<intent-filter>
<intent-filter android:priority="100">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>

<receiver
android:name=".DeviceAdminReceiver"
android:exported="false"
android:label="@string/disabled_camera"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/device_admin" />
</receiver>

</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package me.s1204.galaxycamsnd;

import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import static android.provider.Settings.System.*;
import android.provider.Settings;

public class BootCompletedReceiver extends BroadcastReceiver {
@SuppressLint("UnsafeProtectedBroadcastReceiver")
public void onReceive(Context c, Intent i) {
if (canWrite(c)) {
putInt(c.getContentResolver(), "csc_pref_camera_forced_shuttersound_key", 0);
if (Settings.System.canWrite(c)) {
Settings.System.putInt(c.getContentResolver(), CameraActivity.shutter_sound_volume, 0);
}
}
}
27 changes: 22 additions & 5 deletions app/src/main/java/me/s1204/galaxycamsnd/CameraActivity.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
package me.s1204.galaxycamsnd;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.net.Uri;
import android.provider.Settings;
import android.widget.Toast;

public class CameraActivity extends Activity {

protected static final String shutter_sound_volume = "csc_pref_camera_forced_shuttersound_key";
protected static final String camera_package = "com.sec.android.app.camera";
protected static final String camera_activity = camera_package + ".Camera";
protected static final String package_prefix = "package:";

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent;
finishAndRemoveTask();
Intent intent = null;
if (Settings.System.canWrite(this)) {
Settings.System.putInt(getContentResolver(), "csc_pref_camera_forced_shuttersound_key", 0);
intent = new Intent().setClassName("com.sec.android.app.camera", "com.sec.android.app.camera.Camera");
try {
Settings.System.putInt(getContentResolver(), shutter_sound_volume, 0);
} catch (IllegalArgumentException e) {
e.printStackTrace();
Toast.makeText(this, R.string.failed_write_value, Toast.LENGTH_LONG).show();
}
try {
intent = new Intent().setClassName(camera_package, camera_activity);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Toast.makeText(this, R.string.failed_launch_activity, Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(this, R.string.write, Toast.LENGTH_LONG).show();
intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS, Uri.parse("package:" + getPackageName())).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Toast.makeText(this, R.string.request_write_permission, Toast.LENGTH_LONG).show();
intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS, Uri.parse(package_prefix + getPackageName())).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
startActivity(intent);
}
Expand Down

This file was deleted.

Loading

0 comments on commit ce565fa

Please sign in to comment.